FastEddie___
asked on
Validate Coldfusion Cfinput Textbox with Javascript
How does one valideate a coldfusion cfinput type=text with javascript?
It is cfinput the same as a regular html input in the way it validates?
I would like to exclude characters like * in my text areas.
I have used keyCode values but I'm having a little trouble with thes text areas in Coldfusion.
It is cfinput the same as a regular html input in the way it validates?
I would like to exclude characters like * in my text areas.
I have used keyCode values but I'm having a little trouble with thes text areas in Coldfusion.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
First of all is there any reason for you yo use cfinput ,
with cfinput you can use the same javacript function and call it on the event which you were calling for input
but if you want to write your custom validation stuff i strongly feel there is no need of cfinput unless you have a other strong reason for using it.
with cfinput you can use the same javacript function and call it on the event which you were calling for input
but if you want to write your custom validation stuff i strongly feel there is no need of cfinput unless you have a other strong reason for using it.
ASKER
@srikanthmadis
I'm not looking to replace what coldfusion has built in for form validation.
I am looking to enhance validiation as the user is typing by using onKeyPress.
That way I can check for certain characters and just not allow them to be typed in.
For example:
<cfinput ... onkeypress="return checkDateChars()" validate="date">
-----
function checkDateChars()
{ // 0-9, /, -
if ( ((event.keyCode>47)&&(even t.keyCode< 58)) || (event.keyCode==45) || (event.keyCode==47) )
{
return true;
}
else
return false;
}
---
Along with the onkeypress I also would like to use the onBlur and run my own date validation functions so that the coldfusion validate="date" should never be called except when the user is trying to hack the site.
So what you're saying is that I can use all the colfdfusion tags from cfform (cfinput, cfselect,...) with regular javascript function calls???
I'm not looking to replace what coldfusion has built in for form validation.
I am looking to enhance validiation as the user is typing by using onKeyPress.
That way I can check for certain characters and just not allow them to be typed in.
For example:
<cfinput ... onkeypress="return checkDateChars()" validate="date">
-----
function checkDateChars()
{ // 0-9, /, -
if ( ((event.keyCode>47)&&(even
{
return true;
}
else
return false;
}
---
Along with the onkeypress I also would like to use the onBlur and run my own date validation functions so that the coldfusion validate="date" should never be called except when the user is trying to hack the site.
So what you're saying is that I can use all the colfdfusion tags from cfform (cfinput, cfselect,...) with regular javascript function calls???
ASKER