So I've got a fairly simple form that has a drop down selection and a checkbox.
I'm using this to verify that a school has be selected and that the checkbox has been ticked.
What I'd like to do next is if the function returns true, I'd like to launch a shopping cart using the URL returned by the selection.
The verification works, but I can't figure out how to launch the Window with the dynamic URL.
This is the form:
followed by the selection, etc.
I'm guessing on what to use for action.
Thanks.
I'm using this to verify that a school has be selected and that the checkbox has been ticked.
Code:
<script type="text/javascript">
function validate() {
// Checking if at least one period button is selected. Or not.
if (document.school.selection.value.length <= 2){
alert("Please select your school.");
return false;}
if (!document.school.agree.checked) { alert("Please read and agree to our policies.");
return false; }
return true;
}
function WinOpen() {
var url=document.school.selection.value
document.location.href=url
}
</script>
What I'd like to do next is if the function returns true, I'd like to launch a shopping cart using the URL returned by the selection.
The verification works, but I can't figure out how to launch the Window with the dynamic URL.
This is the form:
Code:
<form id="schoolform" name="school" method="post" action="WinOpen();" onsubmit="return validate()"><input type="hidden" name="todo" value="post">
followed by the selection, etc.
I'm guessing on what to use for action.
Thanks.