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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help me ,simple problem

Status
Not open for further replies.

daka94

Programmer
Apr 27, 2001
33
US
hai;
i am new to java script.i want to do validation for form field.
the follwing code is not working.please help me.

<HTML>
<HEAD>
<title>hello</title>
<script type=&quot;javaScript&quot;>
function setRfq(rfq)
{
if(rfq.rfqname.value==&quot;&quot;)
{
alert(&quot;The Rfq Name field is blank, please enter a value.&quot;);
return true;
}
else
return false;
}
</script>
</HEAD>
<BODY>
<form name=&quot;rfqForm&quot; action=&quot;rfqgeneral.jsp&quot; method=&quot;post&quot; onSubmit=&quot;return setRfq(this)&quot;>
rfq name:<input TYPE=&quot;text&quot; NAME=&quot;rfqname&quot; value>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Enter Order&quot;>
</form>
</BODY>
</HTML>
 
You could try one of two things: pass this.form in your onSubmit statement, or just use document.rfqForm.rfqname.value Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Also, it looks like you've got return true and return false mixed up... Right now when the field is blank it is set to return true (submit the form) and when there isn't it is set to return false (not submit the form).
 
hai
i am getting error when i am using one of the two above things.
error: object expected at line 17(at body tag).
 
On your page you have &quot;<script type=&quot;javaScript&quot;>&quot;
It should be <script [red]language[/red]=&quot;javascript&quot;>...

If you want to specify the type it should be in the following format: <script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top