View Single Post
Old 03-07-2012, 08:34 PM   PM User | #3
aroj
New Coder

 
Join Date: Mar 2012
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
aroj is an unknown quantity at this point
That is helpful, thanks, but it doesn't quite work, yet.

I copy pasted this

Quote:

<html>
<head>
<script>
function validate(form) {
if (document.form.merchant.value == "") {
alert("You did not make a selection");
return false;
}
var directTo = document.form.merchant.value;
window.location=directTo;
}
</script>

</head>

<body>
<form method="post" action="" name="form" onsubmit="return validate(this);">
<fieldset>
Redirect: <select name="merchant">
<option value="" selected="yes">Please select</option>
<option value="https://www.amazon.com">amazon</option>
<option value="https://www.ebay.com">ebay</option>
<option value="https://www.bestbuy.com">bestbuy</option>
</select>
<br />
<input type="submit" name="redirect" value="Submit" />
</fieldset>
</form>
</body>

</html>
in an empty file and saved it. Opened the file with my browser (Firefox). Selected amazon. Clicked submit, and what it does is reset the selected option to "Please select" i.e. the default, rather than redirect to amazon.com

The "You did not make a selection" functionality, however, works.
aroj is offline   Reply With Quote