I am using SimpleModal Basic Modal Dialog and when I try to implement a modal window popup on change of a jump menu, the dialog box opens, but I am quickly redirected to a url that doesn’t exist.
How do I prevent that from happening?
Here is my HTML for the jump menu:
<select name="fieldname" size="1" onChange="go()" class="select" >
<option selected="selected"><em>Questions Bulk Edit Options...</em></option>
<option value="http://74.39.250.15/questions_listing.asp?categoryState=1">Change Category Assignments</option>
<option class="basicConfirmapprove" href="#">Change Status to Approved</option>
<option value="http://74.39.250.15/questions_listing.asp?categoryState=2">Move to Another Folder</option>
</select>
Here is my JavaScript for the page:
<script type="text/javascript">
<!--
function go(){
location=
document.Category.fieldname.
options[document.Category.fieldname.selectedIndex].value
}
//-->
</script>
Here is my HTML for the modal window:
<div id="basic-modal-confirmapprove">
<%
'Page Preferences
PageName = ""
%>
<!--#include file="header_modal.asp"-->
<div><center>Are you sure you want to approve all the selected items?</center></div>
<br />
<div align="center"><a href="#" class="button simplemodal-close">Cancel</a> <a href="#" class="keybutton simplemodal-close">OK</a></div>
<!--#include file="footer_modal.asp"-->
And here is my JavaScript for the modal window:
// Load dialog on click
$('#basic-modal .basicConfirmapprove').click(function (event){
$('#basic-modal-confirmapprove').modal();
return false;
});
How do I prevent the jump to “….com/Change Status to Approved” url? Obviously it doesn’t exist. If I click back, it shows the previous window with the modal window perfectly.
Chris
Because you have the onchange=”go()” event handler wired up, this code will execute as soon as the drop down value changes. You will need to put in something like this if you don’t want to redirect:
This way the redirect will only happen if the value starts with “http”, so if they choose the basicConfirmapprove then you should be safe
Hope this helps.