Copy link to clipboard
Copied
Good morning all,
I have a form that I want to use cfselect to drop employee FN and LN from the drop down username into a readonly cfinput. Do I need to bind or what is the best method to accomplish this? I also want to open a new form (popup) to select from there to other fields in the original form. I know the second part is javascript but can anybody point me in the right direction?
Thanks in advance,
djkhalif
You may use bind in both cases. Here's an example to start you up
<div>
<strong>Form 1</strong>
<cfform id="form1" name="form1">
<select name="firstName">
<option value="">Select first name</option>
<option value="01">Alf</option>
<option value="02">Bill</option>
</select>
<br>
First Name: <cfinput type="text" name="fn" bind="{firstName.text}" readonly="true">
<br>
City: <cfinput type="text" name="city1" bind="{form2:city2}">
<br>
Country: <cfinput type="text" name="country1" bind="{form2:country2}">
</cfform>
Copy link to clipboard
Copied
<input> has a disabled attribute to make it read only. To change the value based on another form field, you'll have to use javascript.
Copy link to clipboard
Copied
You may use bind in both cases. Here's an example to start you up
<div>
<strong>Form 1</strong>
<cfform id="form1" name="form1">
<select name="firstName">
<option value="">Select first name</option>
<option value="01">Alf</option>
<option value="02">Bill</option>
</select>
<br>
First Name: <cfinput type="text" name="fn" bind="{firstName.text}" readonly="true">
<br>
City: <cfinput type="text" name="city1" bind="{form2:city2}">
<br>
Country: <cfinput type="text" name="country1" bind="{form2:country2}">
</cfform>
</div>
<div>
<strong>Form 2</strong>
<cfform id="form2" name="form2">
<select name="city2">
<option value="">Select city</option>
<option value="Amsterdam">Amsterdam</option>
<option value="Bratislava">Bratislava</option>
</select>
<br>
Country: <cfinput type="text" name="country2">
</cfform>
</div>
Copy link to clipboard
Copied
BKBK,
That did it!
Thanks,
djkhalif
Copy link to clipboard
Copied
BKBK,
I do see that in a form the format="flash" does not work bind. Nor can I use values from two columns with <cfselect query="tlkp_Inspector" value="firstName"></cfselect>. For value, value="firstName lastName"
Copy link to clipboard
Copied
Bind works for Flash, too. But, first, you have to remove the HTML tags.
<cfform id="form1" name="form1" format="flash">
<cfselect label="First Name" name="firstName" width="200">
<option value="">Select first name</option>
<option value="01">Alf</option>
<option value="02">Bill</option>
</cfselect>
<cfinput label="FN" type="text" name="fn" bind="{firstName.text}" readonly="true" width="200">
</cfform>
Copy link to clipboard
Copied
BKBK,
I made a change that did not work. I corrected it, now the code works fine.
<cfform format="flash" id="FI" name="FI" action="../ActionPages/finalinspectionaction.cfm" method="post" width="550" height="600">
<cfinput type="datefield" value="#dateformat(Now(), 'mm/dd/yyyy')#" name="inspectionDate" width="120" label="Date of Inspection">
<cfinput type="text" name="WorkOrder" required="yes" message="Oops! You must enter the Work Order Number" width="120" label="Work Order">
<cfselect name="inspectedById" query="inspectBy" value="FullName" display="inspBy" label="Select your name as the Inspector" width="60" required="yes">
</cfselect>
<cfinput name="InspectedByName" type="text" width="120" readonly="true" label="Inspected By" bind="{inspectedById.text}">
<cfinput name="totalInspected" type="text" width="60" readonly="true" label="Total Inspected">
<cfinput name="totaldefective" type="text" width="60" readonly="true" label="Total Defective:">
<cfinput name="totaldefects" type="text" width="60" readonly="True" label="Total Defects:">
<cftextarea name="notes" cols="30" rows="5" label="Comments / Notes"></cftextarea>
<cfinput type="submit" name="submit" value="Submit">
<cfinput type="reset" name="clear" value="Clear Form">
</cfform>