Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onblur drop down issues 1

Status
Not open for further replies.

jeffwest2

MIS
Feb 5, 2009
64
0
0
GB
I have a java page i am trying to invoke an onblur event.

<select onblur=validate(this.value) style="Z-INDEX: 101; POSITION: absolute; WIDTH: 165px; TOP: 105px; LEFT: 112px" id=SELECT1 dataSrc=#SSE_Survey dataFld=Q1 size=1 name=Happy datafldname="Q1" databindingtype="Database">
<option selected value="Please Choose">
Please Choose
</option>
<option value=Y>
Yes
</option>
<option value=N>
No
</option>
</select>

Calling the following function

function validate(value) {
if (value = "Please Choose")
alert("Please Enter a correct value in the drop down box");
}

No matter what is chosen in the drop down it always messages with the error, anyone see what i am missing please, this has been ticking me off all day.

Didn't anyone ever tell you? There's one thing you never put in a trap — if you're smart, if you value your continued existence, if you have any plans about seeing tomorrow — there's one thing you never — ever, put in a trap. … Me.
 
Hi
[ul]
[li][tt]=[/tt] assignment[/li]
[li][tt]==[/tt] equality check[/li]
[/ul]
JavaScript:
[b]function[/b] [COLOR=darkgoldenrod]validate[/color][teal]([/teal]value[teal])[/teal] [teal]{[/teal]
    [b]if[/b] [teal]([/teal]value [teal]=[highlight]=[/highlight][/teal] [green][i]"Please Choose"[/i][/green][teal])[/teal]
    [COLOR=darkgoldenrod]alert[/color][teal]([/teal][green][i]"Please Enter a correct value in the drop down box"[/i][/green][teal]);[/teal]
[teal]}[/teal]

Feherke.
 
Cheers for that, I will give it a test and see what happens.

Didn't anyone ever tell you? There's one thing you never put in a trap — if you're smart, if you value your continued existence, if you have any plans about seeing tomorrow — there's one thing you never — ever, put in a trap. … Me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top