MAYBE I'm Trying To Be Too Clever.  The below are the file contents.  The file posts to itself (because I like things collocated, for no other reason.)  The top part of the FORM is executed when the Form is finalized.  The Bottom part of the file is the first post to the template.
 
<CF_iiAdminSecurity SaveURL="yes" Action="" TableName="AdminArea">
<LINK REL="stylesheet" HREF="" TYPE="text/css">
<CF_AdminHeader>
 
<cfif NOT IsDefined('FIRST_NAME_DEFAULT')>
  <cfset FIRST_NAME_DEFAULT   = "First Name">       <!--- MACRODEFINE: ---->
</cfif>
<cfif NOT IsDefined('LAST_NAME_DEFAULT')>
  <cfset LAST_NAME_DEFAULT    = "Last Name">        <!--- MACRODEFINE: ---->
</cfif>
<cfif NOT IsDefined('COMPANY_NAME_DEFAULT')>
  <cfset COMPANY_NAME_DEFAULT = "Company">          <!--- MACRODEFINE: ---->
</cfif>
 
<!--- ************************************************************************************* --->
<!--- SECOND POST TO TEMPLATE - Save the CLIENT DATA. (With ERROR-Checking.)                --->
<!--- ************************************************************************************* --->
<center>
<cfif IsDefined('ReadyToGo')>
 

  <cfif Company EQ COMPANY_NAME_DEFAULT>      <!--- If No Company Name Entered then a Name must be entered. --->
 
    <cfif FirstName EQ FIRST_NAME_DEFAULT>
      <span class="red">
        ERROR: You did not enter a First Name...<br>
        Hit the <b>BACKSPACE</b> key and fix your entry...<br>
      </span>
      </center>
      <cfabort>
    </cfif>
 
    <cfif LastName EQ LAST_NAME_DEFAULT>
      <span class="red">
        ERROR: You did not enter a Last Name...<br>
        Hit the <b>BACKSPACE</b> key and fix your entry...<br>
      </span>
      </center>
      <cfabort>
    </cfif>
 
  </cfif>
 
  <cfquery name="qAlready" datasource="Repairs">
    SELECT    *
    FROM      Clients
    WHERE    (FirstName = '#FirstName#') AND
             (LastName  = '#LastName#')
      <cfif Address1  NEQ ''>  AND (Address1  = '#Address1#')  </cfif>
      <cfif Address2  NEQ ''>  AND (Address2  = '#Address2#')  </cfif>
      <cfif City      NEQ ''>  AND (City      = '#City#')      </cfif>
      <cfif Zip       NEQ ''>  AND (Zip       = '#Zip#')       </cfif>
      <cfif Telephone NEQ ''>  AND (Telephone = '#Telephone#') </cfif>
      <cfif Email     NEQ ''>  AND (Email     = '#Email#')     </cfif>
      <cfif Company   NEQ ''>  AND (Company   = '#Company#')   </cfif>
  </cfquery>
 
  <cfif qAlready.RecordCount NEQ 0>
    This Client is already in the database...<br><br>
    <br>
    <cfoutput>
      <a href="">Click Here</a>
      To ENTER A Repair Job For This Client Now.
    </cfoutput>
 
  <cfelse>
 
    <cfquery name="SaveClientData" datasource="Repairs">
       INSERT INTO Clients(DateCreated,
                           FirstName,
                           LastName,
                     <cfif Address1  NEQ ''> Address1,   </cfif>
                     <cfif Address2  NEQ ''> Address2,   </cfif>
                     <cfif City      NEQ ''> City,       </cfif>
                     <cfif Zip       NEQ ''> Zip,        </cfif>
                     <cfif Telephone NEQ ''> Telephone,  </cfif>
                     <cfif Email     NEQ ''> Email,      </cfif>
                     <cfif Company   NEQ ''> Company,    </cfif>
                           StateID
                          )
                Values(    #CreateODBCDateTime(now())#,
                          '#FirstName#',
                          '#LastName#',
                     <cfif Address1  NEQ ''> '#Address1#',   </cfif>
                     <cfif Address2  NEQ ''> '#Address2#',   </cfif>
                     <cfif City      NEQ ''> '#City#',       </cfif>
                     <cfif Zip       NEQ ''> '#Zip#',        </cfif>
                     <cfif Telephone NEQ ''> '#Telephone#',  </cfif>
                     <cfif Email     NEQ ''> '#Email#',      </cfif>
                     <cfif Company   NEQ ''> '#Company#',    </cfif>
                           #StateID#
                        )
    </cfquery>
 
    <cfquery name="qClient" datasource="Repairs" maxrows=1>
      SELECT   ClientID
      FROM     Clients
      WHERE   (LastName = '#LastName#') AND (FirstName = '#FirstName#')
      ORDER BY DateCreated DESC
    </cfquery>
    <cfset CID = qClient.ClientID>
 
    <table border="0" cellspacing="0" cellpadding="3" bgcolor="#eaeaea" width="820">
 
      <tr bgcolor="blue">
        <td colspan=2 align="center" class="lgwhite">
          ADD NEW CLIENT - Client Data Saved
        </td>
      </tr>
 
      <tr><td colspan="2">&nbsp;</td></tr>                         <!--- Spacer Row --->
 
      <!--- ******************************** --->
      <!--- CLIENT ID                        --->
      <!--- ******************************** --->
      <tr>
        <td align=right valign="top" width="20%" class="black">
           Client ID:</b>
        </td>
        <td align=left width="32%" class="medblack">
          <cfoutput>
            #CID#
          </cfoutput>
        </td>
      </tr>
 
      <!--- ******************************** --->
      <!--- NAME                             --->
      <!--- ******************************** --->
      <tr>
        <td align=right valign="top" width="20%" class="black">
           Name:</b>
        </td>
        <td align=left width="32%" class="medblack">
          <cfoutput>
            #FirstName# #LastName#
          </cfoutput>
        </td>
      </tr>
 
      <!--- ******************************** --->
      <!--- Company                          --->
      <!--- ******************************** --->
      <tr>
        <td align=right valign="top" width="20%" class="black">
           Company:</b>
        </td>
        <td align=left width="32%" class="medblack">
          <cfoutput>
            #Company#
          </cfoutput>
        </td>
      </tr>
 
      <tr><td colspan="2">&nbsp;</td></tr>                         <!--- Spacer Row --->
 
      <!--- ******************************** --->
      <!--- Add A NEW Job For This Client?   --->
      <!--- ******************************** --->
      <tr>
        <td align=center colspan="2" class="medblack">
          <cfoutput>
            <a href="">Click Here</a>
            To ENTER A Repair Job For This Client Now.
          </cfoutput>
        </td>
      </tr>
 
      <tr><td colspan="2">&nbsp;</td></tr>                         <!--- Spacer Row --->
 
    </table>
 
  </cfif>
 

<!--- ************************************************************************************* --->
<!--- FIRST POST TO TEMPLATE - Provide a CLIENT DATA Entry Form.                            --->
<!--- ************************************************************************************* --->
<cfelse>
 
  <body >
 
  <form name     = "ClientEntry"
        method   = "post"
        action   = "AddNewClient.cfm">
 
  <table border="0" cellspacing="0" cellpadding="3" bgcolor="#eaeaea" width="920">
 
    <tr bgcolor="blue">
      <td colspan=3 align="center" class="lgwhite">
        ADD NEW CLIENT - Enter Client Data
      </td>
    </tr>
 
    <!--- ******************************** --->
    <!--- COMPANY                          --->
    <!--- ******************************** --->
    <tr>
      <td align=right valign="top" class="black">
         Company Name:
      </td>
      <td align=left class="black">
        <cfoutput>
          <input type="text"  name="Company"  size="30"  maxlength="52" <cfif IsDefined("Company") AND (Company NEQ 'Company')>value="#Company#"<cfelse>value="#COMPANY_NAME_DEFAULT#"</cfif>>
        </cfoutput>
      </td>
      <td class="smblack">&nbsp;</td>
    </tr>
 
    <!--- See if the COMPANY is ALREADY in the Database (don't want to enter it TWICE! --->
    <cfif IsDefined('Company') AND (Company NEQ COMPANY_NAME_DEFAULT)>
      <cfquery name="qExistCompany" datasource="Repairs">
        SELECT     *
        FROM       Clients
        WHERE     (Company = '#Company#')
        ORDER BY   Zip
      </cfquery>
 
      <cfif qExistCompany.RecordCount NEQ 0>
        <tr>
          <td bgcolor="red" align="center" class="white">
              Company already appears<br>
              in our database.
          </td>
          <td colspan="2" class="red">
            <cfoutput>
              The Company name <b>#Company#</b> already appears in our database <b>#qExistCompany.RecordCount#</b> time(s).<br>
              <i>Please insure that this Company does not already exist within our database.</i><br>
            </cfoutput>
            Use the <i><b>Zipcode / Phone / Email Address</b></i> below to verify the uniqueness of the Company.<br>
            <select name="ClientExistsCheck">
              <cfoutput query="qExistCompany">
                <option value=#ClientID#> #Zip# / Phone:#Telephone# / #email#
              </cfoutput>
            </select>
          </td>
        </tr>
      </cfif>
    </cfif>
 
    <tr><td colspan="3" class="smblack">&nbsp;</td></tr>                                            <!--- Spacer Row --->
 
    <!--- ******************************** --->
    <!--- NAME                             --->
    <!--- ******************************** --->
    <tr>
      <td align=right valign="top" width="20%" class="black">
         Name:
      </td>
      <td align=left width="32%" class="black">
        <cfoutput>
          <input type="text"  name="FirstName"  size="40"  maxlength="80" <cfif IsDefined('FirstName') AND (FirstName NEQ 'First')>value="#FirstName#"<cfelse>value="#FIRST_NAME_DEFAULT#"</cfif>> <br><!--- > --->
          <input type="text"  name="LastName"   size="40"  maxlength="80" <cfif IsDefined('LastName')  AND (LastName  NEQ 'Last')> value="#LastName#" <cfelse>value="#LAST_NAME_DEFAULT#" </cfif>>     <!--- >   --->
        </cfoutput>
      </td>
      <td class="smblack">
        <i>
           First Name<br>
           Last Name
        </i>
      </td>
    </tr>
 
    <!--- See if the Client is ALREADY in the Database (don't want to enter them TWICE! --->
    <cfif IsDefined('LastName') AND (LastName NEQ LAST_NAME_DEFAULT) AND IsDefined('FirstName') AND (FirstName NEQ FIRST_NAME_DEFAULT)>
      <cfquery name="qExistClient" datasource="Repairs">
        SELECT     *
        FROM       Clients
        WHERE     (FirstName = '#FirstName#') AND (LastName = '#LastName#')
        ORDER BY   Zip
      </cfquery>
 
      <cfif qExistClient.RecordCount NEQ 0>      <!--- Should Never Be More Than one, Right?  How many "John Smith's" could there be???? --->
        <tr>
          <td bgcolor="red" align="center" class="white">
              Name already appears<br>
              in our database.
          </td>
          <td colspan="2" class="red">
            <cfoutput>
              The name <b>#FirstName# #LastName#</b> already appears in our database <b>#qExistClient.RecordCount#</b> time(s).<br>
              <i>Please insure that this Client does not already exist within our database.</i><br>
            </cfoutput>
            Use the <i><b>Zipcode / Phone / Email Address</b></i> below to verify the uniqueness of the Client.<br>
            <select name="ClientExistsCheck">
              <cfoutput query="qExistClient">
                <option value=#ClientID#> #Zip# / Phone:#Telephone# / #email#
              </cfoutput>
            </select>
          </td>
        </tr>
      </cfif>
    </cfif>
 
    <tr><td colspan="3" class="smblack">&nbsp;</td></tr>                                            <!--- Spacer Row --->
 

    <!--- ******************************** --->
    <!--- ADDRESS                          --->
    <!--- ******************************** --->
    <tr>
      <td align=right valign="top" class="black">
         Address:
      </td>
      <td align=left class="black">
        <input type="text"  name="Address1"  size="42"  maxlength="80"><br>
        <input type="text"  name="Address2"  size="42"  maxlength="80">
      </td>
      <td class="smblack">
        <i>
           Line 1<br>
           Line 2
        </i>
      </td>
    </tr>
 
    <tr>
      <td align=right valign="top" class="black">
        City:
      </td>
      <td align=left class="black">
        <input type="text"  name="City"  size="32"  maxlength="80">
      </td>
      <td class="smblack">&nbsp;</td>
    </tr>
 
    <CFQUERY NAME="qStates" datasource="Repairs">
      SELECT     *
      FROM       aslStates
      ORDER BY   StateID
    </CFQUERY>
    <tr>
      <td align=right valign="top" class="black">
        State:
      </td>
      <td align=left class="black">
        <SELECT name="StateID">
          <cfoutput query="qStates">
            <option value=#StateID#> #State#
          </cfoutput>
        </SELECT>
      </td>
      <td class="smblack">&nbsp;</td>
    </tr>
 
    <tr>
      <td align=right valign="top" class="black">
        Zip:
      </td>
      <td align=left class="black">
        <input type="text"  name="Zip"  size="16"  maxlength="14">
      </td>
      <td class="smblack">&nbsp;</td>
    </tr>
 
    <tr><td colspan="3">&nbsp;</td></tr>                                            <!--- Spacer Row --->
 
    <!--- ******************************** --->
    <!--- Phone, Email                     --->
    <!--- ******************************** --->
    <tr>
      <td align=right valign="top" class="black">
         Telephone:
      </td>
      <td align=left>
        <input type="text"  name="Telephone"  size="30"  maxlength="24">
      </td>
      <td class="smblack">&nbsp;</td>
    </tr>
 
    <tr>
      <td align=right valign="top" class="black">
         Email Address:
      </td>
      <td align=left class="black">
        <input type="text"  name="Email"  size="30"  maxlength="52">
      </td>
      <td class="smblack">&nbsp;</td>
    </tr>
 
    <tr><td colspan="3">&nbsp;</td></tr>                                            <!--- Spacer Row --->
 
    <tr>
      <td align="left" colspan="3">
        <cfif IsDefined('qExistCompany') AND (qExistCompany.RecordCount GT 0)>
          <span class="red">
            <b>NOTE:</b>  Please insure that the <b>COMPANY</b> you are now entering now does not already appear in the database
            <B>DO NOT ADD THEM AGAIN.</b><br>
          </span>
        </cfif>
        <cfif IsDefined('qExistClient') AND (qExistClient.RecordCount GT 0)>
          <span class="red">
            <b>NOTE:</b>  Please insure that the <b>CLIENT</b> you are now entering now does not already appear in the database
            <B>DO NOT ADD THEM AGAIN.</b><br>
          </span>
        </cfif>
        <center>
          <input type="checkbox"  name="ReadyToGo">    <b>Check Here When Complete.</b><br>
          <input type="submit"    name="SubmitButton"  value="Save This Client">
        </center>
      </td>
    </tr>
  </table>
  </form>
 
</cfif>
</center>
 
<cf_AdminFooter>
-----Original Message-----
From: Ketan [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 1:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Please Help

If possible give us the HTML code....

Shawn Ingram <[EMAIL PROTECTED]> wrote:

I'm being annoyed by inconsistent (IMO) form behavior.  When I hit TAB the cursor is not advancing to the next form field but the URL is being highlighted in the Address Window (using IE)

I'm sure its something simple but I can't find it.  I'm such a _javascript_ novice that I've even removed all _javascript_ elements and scripts; the only remaining type action I have is an onLoad event handler in a body tag (which does a

"ClientEntryForm.FirstName.select()"

Any clues would be most appreciated.


Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Reply via email to