I don't see any means you're using to get the
values of the first form into the second.

It seems like you're think of an AJAX solution,
such as used by jQuery as a popular solution today,
to get the other form fields to change values
when the work checkbox "Same" is checked.

Rick

-----Original Message-----
From: B Griffith [mailto:[email protected]] 
Sent: Wednesday, January 16, 2013 12:43 PM
To: cf-newbie
Subject: Checkbox/Radio Button integration into CF8 code-block


Hello All,

I'm having an issue (probably w/ syntax) in that my code does not throw an 
error, it simply doesn't work the
way I'm envisioning it...I tried this code both with a single checkbox for 
"Same" and the current way, using a
radio button.  It's probably obvious what I'm trying to do but just in case, a 
brief explanation.

99 out of 100 websites that ask for your residence/mailing address have a 
little checkbox you can tick to tell
the HTML form that they are the same.  More often than not, ticking this box 
will auto-populate the second
address fields of the form for you.

I'm trying to do something similar here with my Add New Client Form, but when I 
enter data in the Client
Business Address rows, then click the "Same" radio button, it doesn't copy the 
data to the Mailing Address
rows (as expected).  Could someone tell me what I'm doing wrong, please?  Code 
follows.

<html>
<head><title>Add New Client</title></head>

<body>
<h2>Add New Client Form</h2><br />
<a href="index.cfm"><h4>Back to Homepage</h4></a>

<div><hr /></div>
<form action="client_input.cfm" method="post">
  <table width="100%" style="height: 40%;" cellpadding="0" cellspacing="0" 
border="1">
    <tr> 
      <td colspan="1">Client Name:</td> 
      <td colspan="2"><input type="text" name="client" id="client" value="" 
/></td>
    </tr>
    <tr>
      <td>Client Phone:</td>
      <td><input type="text" name="phone" id="phone" value="" /></td>
    </tr>
    <tr>
      <td>Client Fax:</td>
      <td><input type="text" name="fax" id="fax" value="" /></td>
    </tr>
    <tr>
      <td>Client Business Address Row 1:</td>
      <td><input type="text" name="baddr1" id="baddr1" value="" /></td>
    </tr>
    <tr>
      <td>Client Business Address Row 2:</td>
      <td><input type="text" name="baddr2" id="baddr2" value="" /></td>
    </tr>
    <tr>
      <td>City:</td>
      <td><input type="text" name="bcity" id="bcity" value="" /></td>
    </tr>
    <tr>
      <td>State:</td>
      <td><input type="text" name="bstate" id="bstate" value="" /></td>
    </tr>
    <tr>
      <td>Zip:</td>
      <td><input type="text" name="bzip" id="bzip" value="" /></td>
    </tr>  
    <tr>
      <td>Check box if Business and Mailing Address are the same:</td>
      <td><input type="radio" name="BMaddr" value="same">Same &nbsp; 
          <input type="radio" name="BMaddr" value="diff">Different </td>
      <cfif IsDefined("form.BMaddr")>
        <cfif form.BMaddr EQ "same">
          <cfset form.maddr1=#form.baddr1#>
          <cfset form.maddr2=#form.baddr2#>
          <cfset form.mcity=#form.bcity#>
          <cfset form.mstate=#form.bstate#>
          <cfset form.mzip=#form.bzip#>
        <cfelseif form.BMaddr EQ "diff">
          <cfset form.maddr1="">
          <cfset form.maddr2="">
          <cfset form.mcity="">
          <cfset form.mstate="">
          <cfset form.mzip="">
        </cfif>
      </cfif>   
    </tr>    
    <tr>
      <td>Client Mailing Address Row 1:</td>
      <td><input type="text" name="maddr1" id="maddr1" value="" /></td>
    </tr>
    <tr>
      <td>Client Mailing Address Row 2:</td>
      <td><input type="text" name="maddr2" id="maddr2" value="" /></td>
    </tr>
    <tr>
      <td>City:</td>
      <td><input type="text" name="mcity" id="mcity" value="" /></td>
    </tr>
    <tr>
      <td>State:</td>
      <td><input type="text" name="mstate" id="mstate" value="" /></td>
    </tr>  
    <tr>
      <td>Zip:</td>
      <td><input type="text" name="mzip" id="mzip" value="" /></td>
    </tr> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:6025
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to