|
Let's take a step back, all you want to do
is check for duplicates before the form is submitted, correct?
The best way (and easiest for
you) would be to do the duplicate check after submitting the form, but if
it's a requirement that its done before, than you should work with a hidden
iFrame and for example check if all fields used in the duplicate check are
populated, if so, then pass the values with JS to the iFrame, the page in the
iFrame does the duplicate search, if anything found then it passes the result
back to the calling page..
The only sample I have is not brilliant, but
hopefully will get you going.
The following is the page that calls the dup
check
--------------------------------------------------
<iframe src="" name="callResource"
width="0" marginwidth="0" height="0" marginheight="0" scrolling="auto"
frameborder="0" style="display: none;"></iframe>
<!--- Include the form
--->
<cfinclude template="frm_person.cfm"> </p>
<div id="duplicateCheck" style="display:
none">
<table width="100%" height="300" border="0" cellspacing="2" cellpadding="2" bgcolor="##F7F7F7" style="border: 1px solid black;"> <tr> <td> <div id="duplicateCheckContent" style="padding-left: 100px;"></div> </td> </tr> </table></div> The following is the page that performs the
duplicate check.
--------------------------------------------------
<cfstoredproc
procedure="spContactDuplicateCheck"
datasource="#application.setting["dsnMain"]#">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" value="#url.firstName#" null="no"> <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" value="#url.lastName#" null="no"> <cfprocresult name="qExactMatch" resultset="1"> <cfprocresult name="qSoundsLike" resultset="2"> </cfstoredproc> <cfoutput>
<cfif qExactMatch.recordCount OR
qSoundsLike.recordCount>
<script> var string = '<p><a href="" >This Person does not exist »</a><br/>Or select existing Person</p><p>Title / First name / Initial / Last name - Position / Company<br/>Email</p><p><strong>#qExactMatch.recordCount# exact matches found.</strong></p>'; <cfloop query="qExactMatch"> string += '<p>#numberFormat(qExactMatch.currentRow, "00")#. #qExactMatch.title# #qExactMatch.firstName# #qExactMatch.initial# #qExactMatch.lastName# - <cfif len(qExactMatch.positionName)>#qExactMatch.positionName# / </cfif> #qExactMatch.organisationName#<br/>#qExactMatch.email# <a href="" target="_blank">[view this contact]</a> or <a href="">[select this person and continue adding a Contact]</a></p>'; </cfloop> string += '</p>'; string += '<p><strong>#qSoundsLike.recordCount# possible matches found.</strong></p>'; <cfloop query="qSoundsLike"> string = string + '<p>#numberFormat(qSoundsLike.currentRow, "00")#. #qSoundsLike.title# #qSoundsLike.firstName# #qSoundsLike.initial# #qSoundsLike.lastName# - <cfif len(qSoundsLike.positionName)>#qSoundsLike.positionName# / </cfif> #qSoundsLike.organisationName#<br/>#qSoundsLike.email# <a href="" target="_blank">[view this contact]</a> or <a href="">[select this person and continue adding a Contact]</a></p>'; </cfloop> string += '</p>'; parent.window.document.all['duplicateCheckContent'].innerHTML
= string;
parent.window.document.all['contact'].style.display = 'none'; parent.window.document.all['duplicateCheck'].style.display = 'inline'; </script> <!--- <cfelse> <script> parent.window.document.all['contact'].style.display = 'inline'; parent.window.document.all['duplicateCheck'].style.display = 'none'; </script> ---> </cfif></cfoutput> Taco Fleur --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004 |
- [cfaussie] RE: Passing Javascript variables to CF Taco Fleur
- [cfaussie] Re: Passing Javascript variables to CF Ryan Sabir
- [cfaussie] RE: Passing Javascript variables to CF George Lu
- [cfaussie] RE: Passing Javascript variables to CF Taco Fleur
- [cfaussie] RE: Passing Javascript variables to CF George Lu
- Taco Fleur
