Michael,

This always seems to be the hardest issue for people who are just getting in
to implement JS to grasp. CF is processed on the server-side and JS is
processed on the client-side. This means that any CF interaction will happen
before it ever gets to the user.

If you're looking to communicate w/the server is pseudo real-time, check out
my Gateway JSAPI:
http://www.pengoworks.com/workshop/js/gateway/

You can use this API to send the text in the fields to the CF, then CF can
check to make sure that the text is valid before doing the next step. The
thing to remember is that this will be an asynchronous action, so other
processing will continue to occur while the browser is waiting for the
response from the server.

-Dan

> -----Original Message-----
> From: Michael Ross [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 16, 2003 9:23 AM
> To: CF-Talk
> Subject: JS and CF question
> 
> Okay shoot me because I can't don't know what to do but I have a form that
> needs to check 3 fields against the db to make sure there isn't a
> duplicate.  I can't make my JS code work because I am not that smart.....
> anyone bored and want to help? :)  HERE is whats between my tags.
> 
> thanks
> <SCRIPT LANGUAGE="JavaScript">
> 
>               <CFSET IP = ''>
>               <CFSET HOST = ''>
>               <CFSET NIC = ''>
>       <CFOUTPUT QUERY="ALL_PCS">
>               <CFSET IP = #listappend(IP, IPADDRESS)#>
>               <CFSET HOST = #listappend(HOST, PCNAME)#>
>               <CFSET NIC = #listappend(NIC, NICADDRESS)#>
>       </CFOUTPUT>
>       <CFSET a = findnocase(document.forms.add.IPADDRESS.value, IP,1)>
>       <CFSET b = findnocase(document.forms.add.PCNAME.value, HOST,1)>
>       <CFSET c = findnocase(document.forms.add.NICADDRESS.value, NIC,1)>
>       <CFIF #VARIABLES.A# IS NOT 0>
>                    alert ("You Entered a Duplicate IP Address.");
>                              return false;
>       </CFIF>
>       <-CFIF #VARIABLES.B# IS NOT 0>
>                    alert ("You Entered a Duplicate PCNAME.");
>                              return false;
>       </CFIF>
>       <CFIF #VARIABLES.C# IS NOT 0>
>                   alert ("You Entered a Duplicate NIC Address.");
>                             return false;
>       </CFIF>
> </script>
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to