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> <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.