Link to home
Start Free TrialLog in
Avatar of mahpog
mahpog

asked on

onBlur coldfusion validate

I have a text field that is entered (18 characters max). and I want to make sure this value does not
already exist on a table. Instead of validating after a submit, I would like to validate after entry is made,...
so onBlur.

I am trying to figure out how to write the function to make cfquery. If exists, error that need to re-enter new
value. I have done 'static' data checks but not a cfquery.

I am on CF 9
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

Use  <CFDIV> tag  for AJAX call.

e.g.


<cfform name="form1">
YOUR INPUT FIELD:<cfinput name="stext1" type="text" >
</cfform>

<!--- CFDIV --->

<cfdiv bindonload="false"  bind="url:CheckInput.cfm?idt={stext1@blur}" ID="theDiv"
        style="background-color:##CCffFF; color:red; height:100"/>




For testing purpose use the following cfm file.

<!-- CheckInput.CFM --->

<cfdump var="#url#">
Avatar of mahpog
mahpog

ASKER

I am attaching what happened. Anyone else with suggestions. i went to Adobe CF 9 Reference with 'same' (not quite) example.  I need more help.  

thx.
example.pdf
Avatar of mahpog

ASKER

Okay, I had a typo. and it is responding with "no record", or dump. But if the record exists, I want the user to re-enter a another number. If the record does not exist, then allow the entry and go to next field.
1. Usage of cfdebug

    Add to your page which is holds cfdiv tag

       e.g. :   http://localhost/mypage.cfm?cfdebug


When ever any AJAX requests are posted, the debug window is updated.

2. You many not have to pass session variable. It is available across all requests/cfm pages.

ASKER CERTIFIED SOLUTION
Avatar of Pravin Asar
Pravin Asar
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mahpog

ASKER

I did learn how to make my syntax work properly.