Ooh, here's where it gets really hairy, though. I neglected to mention in my 
first post that I am using the CF_TwoSelectsRelated tag.

Here's the deal. This is an employee suggestion application. The page I am 
enhancing is the page where the admin can route the suggestion to the 
appropriate group and individual. Each group (e.g. HR, HelpDesk, 
Communications, etc.) has one or more default evaluators assigned to it. The 
CF_TwoSelects related tag creates a query driven drop-down menu for the 
departments. Based on what is selected in the first menu, the second menu is 
then "generated" to display the default evaluator(s) for that group. The 
users have the option to keep this default value from the second list, or 
override it and choose a different value. To choose a different evaluator, 
they can either type in the person's first and last name into the provided 
text box, or they can click a search button. Clicking that button pulls up a 
javascript(from another server) box that queries our LDAP (I didn't write 
it), from which the admin can find the user name, click on the button, and 
the evaluator's NT id is automatically populated into the text field. My 
action page checks to see if the value passed is an NT id or a full name, 
and resolves the full name to the NT id if needed.
(The function for the script is in my application.cfm file, since several 
pages throughout the app use the name picklist.)

WHEW! Okay. So, probably more information than anyone cares to think about, 
but that is what is making this so difficult. Thanks for the code snippets. 
They are helpful--but does anyone know how I would incorporate them based on 
the way my page is currently set up?  Here is a portion of the code on my 
page:

<cfform name="pick_eval" 
action="firstroute_submit.cfm?suggestion_id=#suggestion_id#&location=#session.location#"
 
method="POST" enablecab="Yes">
      <tr>
        <td valign="top">
          <b>Proposed Evaluator Group:<BR>
          <BR>
          Default Evaluator ID:</b></td>
        <td>
          <CF_TwoSelectsRelated QUERY="Evaluators" 
DISPLAY1="evaluator_group_name" DISPLAY2="name"
                VALUE1="evaluator_group_name"
                VALUE2="evaluator_id"
                HTMLBETWEEN="<BR><i>(Current suggested group is 
#find_groupname.evaluator_group_name#.)</i>"
                AUTOSELECTFIRST="YES"
                EMPTYTEXT1="(choose an evaluation group)"
                size2="2"
                forceWIDTH2="30"
                FORMNAME="pick_eval">
      <tr>
        <td valign="top">
          <b>Do you wish to use the default Evaluator for this 
group?</b></td>
        <td>
          <cfinput type="Radio" name="default_eval" value="yes" 
checked="Yes">

          <b>Yes</b>, assign to the default Evaluator.<BR>
          <cfinput type="Radio" name="default_eval" value="no">
          No,
          override this and assign it to: </td>
      </tr>
      <tr>
        <td></td>
        <td>
          <input language="JavaScript" type="text"
                                        size="30" name="assigned_eval" value="" 
class="textbox" title="no 
hint">
          <input language="JavaScript" name="btn_in_assigned_eval" 
type="button" value="Find"
                                        
ONCLICK="call_lon(&quot;site_users:#session.site_grp#&quot;, 
&quot;assigned_eval&quot;,0)"
                                        class="secondarybutton">
          <BR>
          (Enter either the person's first and last name, or search for 
their
          NT userid.)</font></td>
      </tr>



----Original Message Follows----
From: "Jason  Lees (National Express)" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: RE: Is this possible?
Date: Mon, 26 Mar 2001 16:21:24 +0100


what Terri could so is query the DB on loading the page, then validate the
answers with a simple JS function.

<script Language="JavaScript" type="text/javascript">
function Check_Items(Item1,Item2){
        if (Item1.value!=Item2.value){
                alert ("These contradict the DB")
                Item1.setfocus();
        }
        return;
}
</script>

then in the page

<input type="text" Name="MyInput"
onblur="Check_Items(MyInput,#Db_check_Item#);">

this should work, you might have to wrap round a CFOutput, round the Input
tag.

In theory it should work, give it a try and let me know.

Jason Lees
National Express
Email : [EMAIL PROTECTED]


-----Original Message-----
From: David Shadovitz [mailto:[EMAIL PROTECTED]]
Sent: 26 March 2001 16:00
To: CF-Talk
Subject: RE: Is this possible?


But Terri wants to compare the client-side form element values to what's in
the
db.  In order to do this, she'll have to get the db info into JS.  She could

query for the data and then convert it to JS via CFWDDX ACTION=CFML2JS.
-David

On Monday, March 26, 2001 6:40 AM, Dylan Bromby [SMTP:[EMAIL PROTECTED]]
wrote:
 > yes you can do this. you can reference the form elements by object name.
you
 > don't have to submit the form to validate or check values. you can do it
 > using onFocus and/or onBlur.
 >
 > -----Original Message-----
 > From: Terri Stocke [mailto:[EMAIL PROTECTED]]
 > Sent: Monday, March 26, 2001 6:34 AM
 > To: CF-Talk
 > Subject: Is this possible?
 >
 >
 > Hey all,
 >
 > Is it possible to determine what a user has inputted in a form BEFORE the
 > form is submitted? What I would like to do is IF a user makes a selection
in
 > the form that conflicts with information already in the db, I want to 
have
a
 > javascript popup alert them to the discrepancy and have them verify if
they
 > want to continue. Otherwise, just a regular submit button would be
 > displayed.
 >
 > I have the javascript alert/confirm working alright, but I can't figure
out
 > how to get it to check the formfields and only display conditionally. I
 > don't even think this is possible, considering that CF is server-side and
 > essentially what I want to do is have CF determine what was selected
BEFORE
 > it is submitted. Is there a way I can determine this with JavaScript (I'm
 > not very good at JS, so "baby steps", please ;).
 >
 > I know I could do this within CF and just have the form submit to an
interim
 > confirmation page, but I would rather do this on the client.
 >
 > Thanks!
 > Terri
 >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to