Refresh an input tag of parent window after closing popup window

I have a form on a page that has several input tags, select tags, check boxes and so on… I want to give a user the ability to add an item to a select box if the item is not listed in the option list of the select tag. Once the user click the link that opens the popup form I would like to use the submit event of the popup form to close the popup form and then refresh the select tag where it was called from. I would like to refresh only the select tag, not the whole page. I have used this behavior to open my popup

<?php 
   $location = DB::getInstance()->query("SELECT id, location FROM locations");
       if($location->count()){
           foreach($location->results() as $row){
           $selected = $row->id == $user->data()->locationid ? ' selected="selected"' : null;?>
           <option value="<?php echo $row->id ?>"<?php echo $selected?> ><?php echo $row->location ?></option>
  <?php  
    }
       }
   ?>
      </select>&nbsp;&nbsp;&nbsp; <a href="#" onClick="MM_openBrWindow('location.php','locationPopup','toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=900')">New Location</a>
                </div>

Users in this example are able to choose a location in a list of locations. Locations can be added on the fly and I need to give the ability to move back and forth easily to add a new location to the database and quickly resume working on the rest of the form where I am calling the popup from.

You can’t do this with just PHP, you will need to use Javascript/Ajax as well.

Once the user click the link that opens the popup form I would like to
use the submit event of the popup form to close the popup form and then
refresh the select tag where it was called from

Again you will need to use Javascript to create a ‘modal’ then use AJAX to post the data to a seperate PHP file and then update the corresponding DIV with the reponce from that request.

thanks for the info

what if What I want to update is not in a div? Every examples I seen online tonight only talk about updating a div. A select tag with option is quirky enough to get working correctly while using html and php and mysql, I can’t wait to see how much more complicated it will get by having to insert some ajax in there lol… Ok back at searching for good old ajax tutorials… Cheers

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.