Solved

onBlur coldfusion validate

Posted on 2010-11-15
6
697 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 
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 500 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cfspreadsheet 15 131
query of query sort 6 116
How can I use EncodeForURL() in ColdFusion with CFGRID 5 66
Coldfusion remove square brackets from string 4 164
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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