Hi,
I had a form element like this
<input type="text" value="" name="myid" id="id"/>
this input coming from database and there i no wy to add onblur evnt.
so i thought of using jquery blur event.
I need help in that when user enters his id like cf1234 of length six then onblur event hs to fire and check that id entered with database value.
if record foung in database i have to alert user id is valid and if not alert user with id not valid and stop form submit.
dO WE HaVE ANY EXAMPLE THAT HELPS.
Appreciate your help.
Thanks
You can try this, and for the CFC method using javascript you can look here :
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461 172e0811cbec22c24-79f9.html
ITs not perfect, and probbly will need some twekaing ,,,, but its somthgin to start from
<script type="text/javascript">
var formSubmitFlag = false;
// Function that is binded to the keyUp of the textbox
function onTextboxChange(textValue)
{
if(textValue.length == 6)
{
alert('6 carecters - ' + textValue);
// Do validation here ...
// You can use CFC with java script
// and if its validated change the formSubmitFlag = true so the form can be submited
formSubmitFlag = true;
// end if
}
// End function
}
// Form submit control
function checkFormSubmitFlag()
{
if(!formSubmitFlag)
{
alert('Can not submit yet until the field is validated ...');
}
return formSubmitFlag;
}
</script>
<cfform onsubmit="return checkFormSubmitFlag();" name="myForm">
<cfinput type="text" name="mytextbox" onKeyUp="onTextboxChange(this.value);">
<input type="submit" />
</cfform>
North America
Europe, Middle East and Africa
Asia Pacific