Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Empty Variables

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
0
0
US
Using CF8 and usableforms.js at The user will select one of the radio buttons to display the corresponding form field. Fields not selected will not display.

Radio buttons on form:

<tr>
<td class="formTitle" align="right">Select By:</td>
<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
<td valign="top" class="rowText">

<input type="radio" name="rpttype" value="PD" rel="paydate" id="type_pd" />
<label for="type_pd">Pay Date</label><br />

<input type="radio" name="rpttype" value="PC" rel="paycycle" id="type_pc" />
<label for="type_pc">Pay Cycle</label><br />

<input type="radio" name="rpttype" value="DR" rel="daterange" id="type_dr" />
<label for="type_dr">Date Range</label><br />

</td>
</tr>

Form field for pay date is:

<TR rel="paydate">
<td class="formTitle" align="right"><label for="paydate"><span class="accessibility"></span>Pay Date:</label></td>
<td width="#variables.spacerWidth#"><img src="#application.imgSrc#dot.gif" width="1" height="1" border="0"></td>
<td valign="top" class="rowText">
<SELECT name="pay_date" id="paydate" />
<cfloop query="getDates">
<option value="#getDates.PAYDATE#" <cfif getDates.PAYDATE EQ attributes.pay_date> SELECTED</cfif>>#DateFormat(getDates.PAYDATE)#</cfloop>
</SELECT>
</td>
</TR>

At the top of my form I have:

<cfparam name="attributes.pay_date" default="0">
<cfif not isdefined("attributes.pay_date")>
<cfset attributes.pay_date = "01">
</cfif>

I'm trying to pass some kind of string in those other variables that weren't selected, but I keep getting the error message:

Element PAY_DATE is undefined in ATTRIBUTES

Is there a way to do what I want to do?

Thanks,
Sherry
 
this works for me:

<cfparam name="attributes.pay_date" default="10/08/2008">
<cfset startDate = Now()>
<cfset endDate = Now() + 30>


<table>
<TR rel="paydate">
<td class="formTitle" align="right"><label for="paydate"><span class="accessibility"></span>Pay Date:</label></td>
<td width="#variables.spacerWidth#"><img src="./dot.gif" width="1" height="1" border="0"></td>
<td valign="top" class="rowText">
<SELECT name="pay_date" id="paydate" />
<Cfoutput>
<cfloop from="#startDate#" to="#endDate#" index="i" step="#CreateTimeSpan(7,0,0,0)#">
<option value="#dateformat(i, 'mm/dd/yyyy')#" <cfif dateformat(i, 'mm/dd/yyyy') EQ attributes.pay_date> SELECTED</cfif>>#dateformat(i, 'mm/dd/yyyy')#</option>
</cfloop>
</cfoutput>
</SELECT>
</td>
</TR>
</table>

are you missing something else?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top