2 Replies - 3498 Views - Last Post: 15 April 2008 - 09:47 PM Rate Topic: -----

#1 mikhail1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-April 08

client site validation is not working

Post icon  Posted 14 April 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

Is This A Good Question/Topic? 0
  • +

Replies To: client site validation is not working

#2 dswens  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 16-October 07

Re: client site validation is not working

Posted 15 April 2008 - 07:57 PM

View Postmikhail1, on 14 Apr, 2008 - 12:01 PM, said:

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
Was This Post Helpful? 0
  • +
  • -

#3 jorvis  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 11
  • Joined: 04-April 08

Re: client site validation is not working

Posted 15 April 2008 - 09:47 PM

View Postdswens, on 15 Apr, 2008 - 07:57 PM, said:

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1