Question
form data
I am using a function to calculate a value based on numbers
the user enters in text boxes and checkbox selection. I think the
function is working because I get 0 as the value when I process the
form. I don't think the values entered by the user are being
stored by the form, though. I don't see any values when I process the form in the browser.
Do I need to do something else to pass the user entries to my function?
Here is relevant code:
<cfscript>
function lcost(DUP,COPIES,ORIG,SINGLE_SIDE)
{Var total = 0;
if ( form.DUP EQ "yes")
total= form.COPIES *(form.ORIG/2)* .047;
return total;
}
</cfscript>
-----------------------------------------------
<cfparam name="FORM.COLL" default="">
<cfparam name="FORM.DRILL" default="">
<cfparam name="FORM.FOLD" default="">
<cfparam name="FORM.BIND" default="">
<cfparam name="FORM.DUP" default="">
<cfparam name="FORM.COPIES" default="">
<cfparam name="FORM.ORIG" default="">
<cfform name="form2" id="form2" method="post" action="submit.cfm">
<label>PAPER
<select name="PAPERID" id="PAPERID" onkeypress="KeyPress()">
<cfoutput query="paperlist">
<option value>="#paperlist.descr# #paperlist.paperid#"</option>
</cfoutput>
</select>
</label>
<label> COPIES
<cfinput type="text" name="COPIES" onfocus="#lcost(form.dup,form.copies,form.orig,paperlist.single_side)#" accesskey="8" tabindex="8" default = "0" size = "10">
DUP
<cfinput type="checkbox" name="DUP" label="DUP" checked="no" accesskey="10" tabindex="10" value= "">
</label>
<label>DRILL
<cfinput type="checkbox" name="DRILL" value="DRILL" accesskey="11" tabindex="11">
</label>
<label>FOLD
<cfinput type="checkbox" name="FOLD" value="FOLD" accesskey="12" tabindex="12">
</label>
<label>BIND
<cfinput type="checkbox" name="BIND" value="BIND" accesskey="13" tabindex="13">
</label>
<label>COLL/STAPLE
<cfinput type="checkbox" name="COLL" value="COLL" accesskey="13" tabindex="13">
</label>
<label>AMT
<cfoutput>
<input type="text" name="amt" value="#lcost(form.dup,form.copies,form.orig,.047)#" >
</cfoutput>
</label>
<p>
<cfinput type="text" name="ORIG" size = "10" >
</p>
</cfform>
stored by the form, though. I don't see any values when I process the form in the browser.
Do I need to do something else to pass the user entries to my function?
Here is relevant code:
<cfscript>
function lcost(DUP,COPIES,ORIG,SINGLE_SIDE)
{Var total = 0;
if ( form.DUP EQ "yes")
total= form.COPIES *(form.ORIG/2)* .047;
return total;
}
</cfscript>
-----------------------------------------------
<cfparam name="FORM.COLL" default="">
<cfparam name="FORM.DRILL" default="">
<cfparam name="FORM.FOLD" default="">
<cfparam name="FORM.BIND" default="">
<cfparam name="FORM.DUP" default="">
<cfparam name="FORM.COPIES" default="">
<cfparam name="FORM.ORIG" default="">
<cfform name="form2" id="form2" method="post" action="submit.cfm">
<label>PAPER
<select name="PAPERID" id="PAPERID" onkeypress="KeyPress()">
<cfoutput query="paperlist">
<option value>="#paperlist.descr# #paperlist.paperid#"</option>
</cfoutput>
</select>
</label>
<label> COPIES
<cfinput type="text" name="COPIES" onfocus="#lcost(form.dup,form.copies,form.orig,paperlist.single_side)#" accesskey="8" tabindex="8" default = "0" size = "10">
DUP
<cfinput type="checkbox" name="DUP" label="DUP" checked="no" accesskey="10" tabindex="10" value= "">
</label>
<label>DRILL
<cfinput type="checkbox" name="DRILL" value="DRILL" accesskey="11" tabindex="11">
</label>
<label>FOLD
<cfinput type="checkbox" name="FOLD" value="FOLD" accesskey="12" tabindex="12">
</label>
<label>BIND
<cfinput type="checkbox" name="BIND" value="BIND" accesskey="13" tabindex="13">
</label>
<label>COLL/STAPLE
<cfinput type="checkbox" name="COLL" value="COLL" accesskey="13" tabindex="13">
</label>
<label>AMT
<cfoutput>
<input type="text" name="amt" value="#lcost(form.dup,form.copies,form.orig,.047)#" >
</cfoutput>
</label>
<p>
<cfinput type="text" name="ORIG" size = "10" >
</p>
</cfform>
