Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

onBlur coldfusion validate

Posted on 2010-11-15
6
Medium Priority
?
719 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:mahpog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 34145486
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#">
0
 

Author Comment

by:mahpog
ID: 34146734
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
0
 

Author Comment

by:mahpog
ID: 34146828
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.
0
Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

 
LVL 29

Expert Comment

by:Pravin Asar
ID: 34147606
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.

0
 
LVL 29

Accepted Solution

by:
Pravin Asar earned 1500 total points
ID: 34147751
Here is better checkinput.cfm

<!---<cfdump var="#url#">--->

<cfset reclist="1,3,5">
<cfset found=false>
<cfloop index="ix" from="1" to="#ListLen(reclist)#">
<cfif ListGetAt(reclist,ix) eq #url.stext1#>
<cfset found=true/>
<cfbreak/>
</cfif>
</cfloop>
<cfoutput>
<cfif #found#>
<script type="text/javascript">
document.form1.stext1.value='RECORD EXISTS, Enter Another Number';
</script>
<cfelse>
<h2>RECORD DOES NOT EXISTS</h2>
</cfif>
</cfoutput>


The main page is unchanged.



<cfform name="form1">
<br/>TEXT:<cfinput name="stext1" type="text" >
</cfform>
<cfdiv bindonload="false"   bind="url:CheckInput.cfm?stext1={stext1@blur}" ID="theDiv"
        style="background-color:##CCffFF; color:red; height:100"/>

0
 

Author Closing Comment

by:mahpog
ID: 34149453
I did learn how to make my syntax work properly.
0

Featured Post

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question