House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Help a Newbie?

Author:
Guy Germaine
05/14/2007 07:39 AM

I am trying to create a form where the user enters their user id, hits a “Populate” button, and the form goes out to our Phone database and gathers some information. This is using a Custom Tag. (That works) One Problem is that the Custom Tag that I use to retrieve the information from the Phone database runs when the page loads, so I get a “Not In Phone” in the Last Name field on my form. That tells me that the Custom Tag is being executed without being called. I am also trying to put the data into a table so I can possibly use it later. When the user clicks the “Populate” button, it inserts the data from Phone into my table (before the user completes the rest of the form). When the user completes the rest of the form, and hits “Submit” it creates another new record in the table with “Not In Phone” in the first part of the table, and the correct information from the form in the rest of the fields.  Below is the code. TEST.CFM <script language="javascript"> function checkForm() {   if (document.form.soe.checked)   {     if (document.form.region1.selectedIndex == 0)   {       alert("Please enter the SOE Center Region")       document.form.region1.focus();       return false;       }   } return true; } </script> </head> <body style="font-family: arial"> <cfset form.sbcuid=""> <cfset the_super_sbcuid=""> <cfset the_fn=""> <cfset the_ln=""> <cfset the_email=""> <cfset region=""> <cfset center=""> <cfset the_uuid=""> <cfset my_uuid=""> <cfset the_phone_number=""> <cfset the_state=""> <cfset superhrid=""> <cfset newracf=""> <cfset currentracf=""> <cfset bac=""> <cfset euam=""> <cfset cbs=""> <cfset on_unix=""> <cfset pocits=""> <cfset soe=""> <cfset sots=""> <cfset watssop=""> <cfset comments=""> <cfset boss_uuid=""> <cfset region1=""> <!--- <cfparam name="form.sbcuid" type="string" default=""> <cfparam name="the_super_sbcuid" type="string" default=""> <cfparam name="form.the_fn" type="string" default=""> <cfparam name="form.the_ln" type="string" default=""> <cfparam name="form.the_email" type="string" default=""> <cfparam name="form.region" type="string" default=""> <cfparam name="form.center" type="string" default=""> <cfparam name="the_uuid" type="string" default=""> <cfparam name="form.my_uuid" type="string" default=""> <cfparam name="form.the_phone_number" type="string" default=""> <cfparam name="the_state" type="string" default=""> <cfparam name="form.superhrid" type="string" default=""> <cfparam name="form.newracf" type="string" default=""> <cfparam name="form.currentracf" type="string" default=""> <cfparam name="form.bac" type="string" default=""> <cfparam name="form.euam" type="string" default=""> <cfparam name="form.cbs" type="string" default=""> <cfparam name="form.on_unix" type="string" default=""> <cfparam name="form.pocits" type="string" default=""> <cfparam name="form.soe" type="string" default=""> <cfparam name="form.sots" type="string" default=""> <cfparam name="form.watssop" type="string" default=""> <cfparam name="form.comments" type="string" default=""> <cfparam name="the_fn" type="string" default=""> <cfparam name="boss_uuid" type="string" default=""> <cfparam name="form.region1" type="string" default=""> ---> <cfset formsubmitted = "no">    <p><img src="Images/att_horiz_color_sml.jpeg" width="207" height="120" border="0"></p>   <table width="499" border="0">     <tr>       <td width="493" bgcolor="#336699"> <div align="center"><font color="#FFFF00" size="5"><strong>RACF           ID Request Form</strong></font></div></td>     </tr>   </table> <cfform method="post" name="form" onSubmit="return checkForm();">   <cfinput type="text"               name="SBCUID"         required="no"         message="SBCUID is Required"               size="6"               maxlength="6">   <cfmodule  name    = "getUserInfo2"      sbcuid    = "#form.sbcuid#"      outlastname   = "the_ln"      outfirstname  = "the_fn"      outofffirstname  = "the_off_fn"      outmiddlename  = "the_mn"      outemail   = "the_email"      outphonenumber  = "the_phone_number"      outphonenumberext = "the_phone_ext"      outcountry      = "the_country"      outcellphonenumber = "the_cell_phone_number"      outstreetaddr1  = "the_street_addr_1"      outstreetaddr2  = "the_street_addr_2"      outcity    = "the_city"      outstate   = "the_state"      outzip    = "the_zip"      outzipplus4   = "the_zip_plus_4"      outfax    = "the_fax"      outpager   = "the_pager"      outpagerpin   = "the_pager_pin"      outtitle   = "the_title"      outtitlesuffix  = "the_title_suffix"      outrcarc   = "the_RC_ARC"      outsupersbcuid  = "the_super_sbcuid"      outcontractorflag = "the_contractor_flag"      outmgmtlevel  = "the_mgmt_level"      outmgmtlevelindicator= "the_mgmt_level_indicator"      outsbcuid   = "the_sbc_uid"      outuuid    = "the_uuid"      outpayrollcompany = "the_payroll_company"      outcompanycode   = "the_company_code"      outdepartment  = "the_department"      outlocationcode  =  "locationcode"      outdomjobfunccode =  "dom_job_func_code"      outbuildingcode  =  "buildingcode"      outttfirstname  =  "the_tt_fn"      outttlastname  =  "the_tt_ln"      >   <cfset my_uuid = #the_uuid#>   <cfset boss_id = #the_super_sbcuid#>   <!--- This is the second search thru Phone using the Supervisor's ID to get the First and Last Names of your Supervisor --->   <cfinput type="Submit" name="Submit2" value="Populate">   <cfmodule  name    = "getUserInfo2"      sbcuid    = "#boss_id#"      outlastname   = "boss_ln"      outfirstname  = "boss_fn"      outuuid    = "boss_uuid"   >   <cfset sbcuid = "#form.sbcuid#">   <cfset my_fn = "#the_fn#">   <cfset my_ln = "#the_ln#">   <cfset my_uuid = "#my_uuid#">   <cfset my_email = "#the_email#">   <cfset my_phone_number = "#the_phone_number#">   <cfset my_state = "#the_state#"> </cfform> <p><strong><font size="2">Enter your SBC User ID and click on the "Populate"   Button</font></strong></p> <cfset formsubmitted="yes"> <cfoutput>   <table width="500" border="1" bgcolor="FEFEE6" >     <tr>         <td width="83"><strong><font size="2">SBCUID:</font></strong>:</td>         <td width="405"><font size="2">#form.sbcuid#</font></td>     </tr>     <tr>         <td width="83"><strong><font size="2">First Name</font></strong>:</td>         <td width="405"><font size="2">#the_fn#</font></td>     </tr>     <tr>         <td width="83"><strong><font size="2">Last Name:</font></strong></td>         <td><font size="2">#the_ln#</font></td>     </tr>        <tr>         <td width="83"><strong><font size="2">State:</font></strong></td>         <td><font size="2">#the_state#</font></td>     </tr>        <tr>         <td width="83"><strong><font size="2">HRID:</font></strong></td>         <td><font size="2">#my_uuid#</font></td>     </tr>     <tr>         <td width="83"><strong><font size="2">Email:</font></strong></td>         <td><font size="2">#the_email#</font></td>     </tr>     <tr>         <td width="83"><strong><font size="2">Phone:</font></strong></td>         <td><font size="2">#the_phone_number#</font></td>     </tr>     <tr>         <td width="83"><strong><font size="2">Supervisor's HRID:</font></strong></td>         <td valign="bottom"><font size="2">#boss_uuid# </font></td>     </tr> </table> </cfoutput> <cfform method="post" name="form1" action="RACF_Prov_SQL.cfm" onSubmit="return checkForm();">   <table>     <tr>       <td colspan="2"><hr> <p><font color="#FF0000"><strong>Check the box if this           is for a NEW RACF ID:           <cfinput type="checkbox" name="newracf" required="No" value="Yes"   style="margin-left: 20px">           </strong></font></p>         <p><font color="#000000">OR</font></p>         <p><font color="#000000">Enter your Existing RACF ID:</font>           <cfinput type="text"               name="currentracf"               required="no"               size="16"               maxlength="16">         </p>         <hr> </td>     </tr>     <tr>       <td colspan="2"><font color="#000000">Please place a checkmark next to the         systems you need access to:</font></td>     </tr>     <tr>       <td> <div align="left"></div></td>       <td> <cfinput type="checkbox" name="bac" required="No" value="Yes" style="margin-left: 20px">         <font color="#000000">BAC</font> </td>     </tr>     <tr>     <tr>       <td> <div align="left"></div></td>       <td> <cfinput type="checkbox" name="euam" required="No" value="Yes" style="margin-left: 20px">         <font color="#000000">Business Direct EUAM/eBill</font> </td>     </tr>     <td> <div align="left"></div></td>     <td> <cfinput type="checkbox" name="cbs" required="No" value="Yes" style="margin-left: 20px">       <font color="#000000">CBS</font> </td>     </tr>     <tr>       <td> <div align="left"></div></td>       <td> <cfinput type="checkbox" name="on" required="No" value="Yes" style="margin-left: 20px">         <font color="#000000">ON</font> </td>     </tr>     <tr>       <td> </td>       <td><cfinput type="checkbox" name="pocits" required="No" value="Yes" style="margin-left: 20px">         <font color="#000000">POCITS</font> </td>     </tr>     <tr>       <td> </td>       <td><cfinput type="checkbox" name="soe" required="No" value="Yes" style="margin-left: 20px">         <font color="#000000">SOE    Center:</font> <cfselect name="center">           <option selected value=""></option>           <option>BCS West</option>           <option>BCS Midwest</option>           <option>BCS Southwest</option>           <option>BCS East</option>           <option>Global</option>           <option>Southeast</option>         </cfselect> <font color="#FF0000">*Required*</font> </td>     </tr>     <td height="27"> </td>     <td><cfinput type="checkbox" name="sots" required="No" value="Yes"   style="margin-left: 20px">       <font color="#000000">SOTS</font> </td>     </tr>     <tr>       <td> </td>       <td><cfinput type="checkbox" name="watssop" required="No" value="Yes" style="margin-left: 20px">         <font color="#000000">WATS/SOP</font></td>     </tr>     <tr>       <td width="100" align="right"> <font color="#000000">Comments:</font> </td>       <td width="500" align="left"> <textarea name="comments"                cols="35"               rows="5"                wrap="virtual">Type any additional comments here</textarea> </td>     </tr>     <tr height="15">       <td></td>     </tr>     <tr>       <td height="50" colspan="2" align="center">     <input type="submit" name="Submit" value="Submit Form">     <cfset formsubmitted = "no">       <input name="button" type="button"  onClick= window.close() value="Close Form">   </table>    </cfform> RACF_PROV_SQL.CFM <cfinclude template="test.cfm"> <CFQUERY DATASOURCE="#variables.datasource#" USERNAME="#USERNAME#" PASSWORD="#PASSWORD#" NAME="Update"> INSERT INTO Prov_Requests (SBCUID, hrid, fname, lname, email, region, phone, state, superhrid, newracf, currentracf, bac, euam, cbs, On_Unix, pocits, soe, center, sots, watssop, comments, dateopened) VALUES ('#form.SBCUID#','#my_uuid#','#my_fn#','#my_ln#','#my_email#','#region#','#my_phone_number#','#my_state#','#boss_uuid#','#newracf#','#currentracf#','#bac#','#euam#','#cbs#', '#On_Unix#','#pocits#','#soe#','#center#','#sots#','#watssop#','#TRIM(comments)#','#DateFormat(Now())#') </CFQUERY>


Search cf-talk

March 19, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31