...

View Full Version : Submit



stickers
09-04-2010, 05:51 PM
Hi,


I want submit a form when highlight options select value = true.

I did the following code, but it not works. Could someone help me to fix it?



<script type="text/javascript" language="JavaScript">
if onfocus="url.select()"
Return true; {
document.form1.submit();
}
</script>

stickers

Philip M
09-04-2010, 06:58 PM
I want submit a form when highlight options select value = true.


Waht does that mean? Do you want to submit a form when a particular select box option is selected? Please give a clearer example.

Javascript is case sensitive - so Return true will not do anything. If it did then that would end the function and the next line document.form1.submit(); is never reached. I have no idea what the braces {} are supposed to do.


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

stickers
09-04-2010, 07:16 PM
Exactly. I want to submit a form when a particular select box option is selected (onfocus)?

Best regards

stickers

Philip M
09-04-2010, 08:33 PM
Like this:-



<select id = "mySel" onchange="go()">
<option value = 0>Choose .....</option>
<option value = 1>Option 1</option>
<option value = 2>Option 2</option>
<option value = 3>Submit The Form</option>
</select>

<script type = "text/javascript">

function go() {
var val = document.getElementById("mySel").value;
if (val == 3) {
document.form1.submit();
}

}

</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum