Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:58:08+00:00 2026-05-22T22:58:08+00:00

at first sorry about my poor English. Now Im having a problem in closing

  • 0

at first sorry about my poor English.
Now Im having a problem in closing and passing params to a modalbox, hope you guys can help me.
Im working with Zend Framework. I have an index page (action) and a hyperlink within it to call a modal box (using ajax).

    <a class="button white"  href="javascript:void(0)" 
onclick="openPopup(<?php echo $group->getId() ?>,'<?php echo $this->baseUrl('admin/group/edit-box')?>')">
        Open Popup
    </a>

I have a div tag for display result from openPopup function above in Index page too

<form id="newEditForm" name="newEditForm" method="post" action="<?php echo $this->baseUrl('admin/group/edit-box')?>" enctype="multipart/form-data">
<div id="editBoxDiv"></div>
</form>

This is the openPopup function :

 function openPopup(id, url){
        $.ajax({
            type: "POST",
            url: url,
            data: "id="+id,
            success: function(result) {
                    $("#editBoxDiv").html(result);
                    $( "#dialog-modal-edit" ).dialog({
                      bgiframe: true,
                      autoOpen: false,
                      width: 990,
                      hide: 'blind',
                      height: 620,
                      modal: true,
                      draggable: true,
                      resizable: true,
                      close : function(){

                      }

                });

                    $("#dialog-modal-edit" ).dialog('open');
            }
          });
    }

This is edit-box.phtml

<script type="text/javascript">
setRoleText = function(name){

    $('#editTextboxes :input[id=role]').val(name.value);
}
</script>
    <div id="dialog-modal-edit" title="Edit group" style="display: none;">
    <div id="editTextboxes">
                            <label class="form-label required">Group name</label>
                            <input id="name" class="form-field width60" name="name" type="text" value="<?php echo $group->getName() ?>" maxlength="100" onkeyup="setRoleText(this)"/>

                            <label class="form-label required">Group Role</label>
                            <input id="role" class="form-field width60" name="role" type="text" value="<?php echo $group->getRole() ?>" maxlength="100"/>
                        </div>
    </div>

The problem is, the first time I open the modalbox, every letter i typed in [input : name] will be set for [input : role] through setRoleText function, it works so far so good. But when I close the modalbox and open it again, the textboxes value(s) dont correct as they should be (I mean the value passed from the edit-box action) but they are the values that i’ve typed at the first time I open the modalbox.

I’ve tried to destroy the modalbox before re-init it while calling ajax

$("#dialog-modal-edit" ).dialog('destroy');
$("#dialog-modal-edit" ).dialog({
    //init code here
});

but nothing works.

So I decided change the autoOpen of the modal box to true, and here is the openPopup function after changed :

function openPopup(id, url){

    $.ajax({
        type: "POST",
        url: url,
        data: "id="+id,
        success: function(result) {
                $("#editBoxDiv").html(result);
                $( "#dialog-modal-edit" ).dialog({
                  bgiframe: true,
                  autoOpen: true,
                  width: 990,
                  hide: 'blind',
                  height: 620,
                  modal: true,
                  draggable: true,
                  resizable: true,
                  close : function(){

                  }

            });

        }
      });
}

Then the textboxes’ values now are correct as they should be. But the setRoleText function just only works at the first time i open the modal box. At the second time, the setRoleText function doesnt work and go on at the 3rd, 4th …
Any idea with this ???
Thanks so much for reading.
Regards.

UPDATE :

I’ve just found one way to solve this problem, but there is still issue.

function openPopup(id, url, name, role){
        $.ajax({
            type: "POST",
            url: url,
            data: "id="+id,
            success: function(result) {
                    $("#editBoxDiv").html(result);
                    $( "#dialog-modal-edit" ).dialog({
                      bgiframe: true,
                      autoOpen: false,
                      width: 990,
                      hide: 'blind',
                      height: 620,
                      modal: true,
                      draggable: true,
                      resizable: true,
                      close : function(){

                      }

                });
$('#editTextboxes :input[name=name]').val(name);
            $('#editTextboxes :input[name=role]').val(role);
                    $("#dialog-modal-edit" ).dialog('open');
            }
          });
    }

As you can see, I passed two more params into openPopup function and it worked. But how about if there is more than 2 params (ex : 10 params) ? I dont think passing all params to function is the good idea. So, still need your helps. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:58:09+00:00Added an answer on May 22, 2026 at 10:58 pm

    Yup, finally I found the way to solve my problem. Hope this will be useful for someone need.

    Just so simple :

    function openPopup(id, url){
    
        $.ajax({
            type: "POST",
            url: url,
            data: "id="+id,
            success: function(result) {
                $("#editBoxDiv").html(result);
    
                    $( "#dialog-modal-edit" ).dialog({
                      bgiframe: true,
                      autoOpen: true,
                      width: 990,
                      hide: 'blind',
                      show: 'blind',
                      height: 620,
                      modal: true,
                      draggable: true,
                      resizable: true,
                      ***close : function(){
                        $(this).remove();
                      }***
                    });
    
    
            }
          });
    }
    

    When close the modalbox, just remove it and everything is fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, sorry about my English, I know it's bad, but I'm trying to make
first, sorry about my english, i still learning. I writing Python module for my
Ok my first question was not clear so i m sorry about that. For
First let me say I really sorry for asking a question about facebook. I'm
Sorry for the slightly noobish question, as I am writing my first rails app.
First of all, sorry for the question title - I was unable to think
First, let's get the security considerations out of the way. I'm using simple authentication
First off, I am using Windows XP. I have multiple hard drives and it
First off, I understand the reasons why an interface or abstract class (in the
First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.