Welcome to Dream.In.Code
Getting Help is Easy!

Join 118,477 Programmers for FREE! Ask your question and get quick answers from experts. There are 927 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



client site validation is not working

 
Reply to this topicStart new topic

client site validation is not working

mikhail1
post 14 Apr, 2008 - 12:01 PM
Post #1


New D.I.C Head

*
Joined: 14 Apr, 2008
Posts: 1

Since I upgraded to CF MX7 auto-validation on my cfinput forms stops working, if I have my custom Javascript onSubmit handler
Example:

<script language="javascript">
function ValidateForm()
{
if (document.form.ESC.value == "")
{
alert('You have not entered an account number')
document.form.ESC.focus();
return false;
}
return true;
}
</script>

<cfform action="" method="post" name="form" onSubmit="return ValidateForm()">
<table width="600" border="1">
<tr>
<td> </td>
</tr>
<tr>
<td>
<cfinput type="text" name="ESC" validate="float"/>
</td>
</tr>
<tr>
<td><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
</cfform>
Please advise
Thanks
User is offlineProfile CardPM

Go to the top of the page


dswens
post 15 Apr, 2008 - 07:57 PM
Post #2


New D.I.C Head

*
Joined: 16 Oct, 2007
Posts: 34


My Contributions


QUOTE(mikhail1 @ 14 Apr, 2008 - 12:01 PM) *

Since I upgraded to CF MX7 auto-validation on my cfinput forms stops working, if I have my custom Javascript onSubmit handler
Example:

<script language="javascript">
function ValidateForm()
{
if (document.form.ESC.value == "")
{
alert('You have not entered an account number')
document.form.ESC.focus();
return false;
}
return true;
}
</script>

<cfform action="" method="post" name="form" onSubmit="return ValidateForm()">
<table width="600" border="1">
<tr>
<td> </td>
</tr>
<tr>
<td>
<cfinput type="text" name="ESC" validate="float"/>
</td>
</tr>
<tr>
<td><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
</cfform>
Please advise
Thanks


Drop the javascript and just add a REQUIRED="YES" to your input tag
User is offlineProfile CardPM

Go to the top of the page

jorvis
post 15 Apr, 2008 - 09:47 PM
Post #3


New D.I.C Head

*
Joined: 4 Apr, 2008
Posts: 11


My Contributions


QUOTE(dswens @ 15 Apr, 2008 - 07:57 PM) *

Drop the javascript and just add a REQUIRED="YES" to your input tag


dswens's suggestion will prevent the form submit, but it won't return the error message.

kill the javascript, then add:

required="yes" message="You have not entered an account number" to your cfinput tag.

That will both prevent the form input, and create the alert.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/11/08 05:48AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month