Click to See Complete Forum and Search --> : Alert message on select option


florida
01-31-2003, 02:23 PM
I have a form that I want to pop up an alert message is someone selects the letter "A" from my select menu. I tried all different stuff and cant get the alert message to pop up when "A" is selected. I tried :
if(document.myform.myvalue.value = "A")

and it popped up alert message on all selections.

Here is the whole form part where I tried:


function check()
{


if(document.myform.myvalue.value == "A")
{
alert("Dont select the letter A")
return false

}



<cfform name="myform" action="dosomething.cfm" onSubmit="return check();">


<select name="myvalue" size="1">
<option value="A" selected>A</option>
<option value="b">b</option>
<option value="c">c</option>

</select>

numba_one
01-31-2003, 02:30 PM
Heres sumthin i got for you.....this one is with ait what you want...

<form><input type="button" value="click here" onClick='alert("Your message here")'></form>

Webskater
01-31-2003, 02:32 PM
function check()
{


if(document.myform.myvalue.options[myform.myvalue.selectedIndex].text == "A")
{
alert("Dont select the letter A")
return false
}
else
{
return true
}

florida
01-31-2003, 03:09 PM
Thanks!