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!

Recursive use of forms and sending parameters 1

Status
Not open for further replies.

davejoyce

Programmer
Jun 26, 2000
29
0
0
US
Visit site
Hi, <br><br>&nbsp;I am trying to create a form that calls itself on a submit and passes one of the fields on the form to the new instance. I can't get <font color=red>UserEnteredDate</font> to be recognized? <br><br>any suggestions?<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dave Joyce<br><br><br>&lt;CFPARAM NAME=&quot;ArchiveDate&quot; DEFAULT=&quot;&quot;&gt;<br><br>&lt;CFQUERY NAME=&quot;GetArchiveData&quot; DATASOURCE=&quot;GeneralArchive&quot;&gt;<br> SELECT&nbsp;&nbsp;ID, SnapshotDate, plant, status<br> FROM&nbsp;&nbsp;StatusSnapshot_tbl<br> WHERE SnapshotDate = '#ArchiveDate#'<br> ORDER by ID<br>&lt;/cfquery&gt;<br><br>&lt;html&gt;<br><br>&lt;head&gt;<br> &lt;title&gt;Archive Status Report&lt;/title&gt;<br>&lt;/head&gt;<br><font color=red><br>&lt;CFFORM action=&quot;status2.cfm?ArchiveDate=#UserEnteredDate#&quot;&gt;<br></font><br><br>&lt;H3&gt;&lt;font color=&quot;Blue&quot;&gt;AFSM 100 - Checklist Daily Status Report&lt;/font&gt;<br>&lt;font size=&quot;-1&quot;&gt;&lt;Input Type=&quot;submit&quot; value=&quot;Archive Report&quot;&gt;<br><font color=red>&lt;INPUT TYPE=&quot;text&quot; Name=&quot;UserEnteredDate&quot;&gt;</font><br>(mm/dd/yy)&lt;/font&gt;<br>&lt;/h3&gt;<br><br>&lt;!--- create table for display ---&gt;<br><br>&lt;table border=&quot;1&quot; cellspacing=&quot;2&quot; width=100% Align=&quot;CENTER&quot; bgcolor=&quot;silver&quot; &gt;<br>&lt;TR&gt;<br>&lt;TD align=&quot;center&quot; colspan=&quot;2&quot;&gt;&lt;font size=&quot;-1&quot;&gt;&lt;/td&gt;<br>&lt;TD align=&quot;center&quot; colspan=&quot;2&quot;&gt;&lt;font size=&quot;-1&quot;&gt;&lt;b&gt;Items&lt;/b&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;TR&gt;<br>&lt;TD align=&quot;center&quot;&gt;&lt;font size=&quot;-1&quot;&gt;&lt;b&gt;Site&lt;/b&gt;&lt;/td&gt;<br>&lt;TD align=&quot;center&quot;&gt;&lt;font size=&quot;-1&quot;&gt;&lt;b&gt;Daily Status&lt;/b&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br><br>&lt;CFOUTPUT QUERY=&quot;GetArchiveData&quot;&gt;<br>&lt;tr&gt;<br>&lt;td&gt;&lt;align=&quot;right&quot;&gt;&lt;font size=&quot;-1&quot;&gt;#Plant#&lt;/font&gt;&lt;/td&gt;<br>&lt;td&gt;&lt;align=&quot;left&quot;&gt;&lt;font size=&quot;-1&quot;&gt;#status#&lt;/font&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br>&lt;/cfoutput&gt;<br><br>&lt;/table&gt;<br>&lt;/cfform&gt;<br><br>&lt;/body&gt;<br><br>&lt;/html&gt;<br>
 
Your problem is that when this template is run for the first time (before the user has the chance to fill in the UserEnteredDate field, CF has no idea what the value of UserEnteredDate is when it executes the CFFORM tag.<br><br>1. remove the ?ArchiveDate=#UserEnteredDate# from the CFFORM's ACTION parm.<br><br>2. Rename the &lt;INPUT TYPE=&quot;Text&quot; field to ArchiveDate.<br><br>The result will be that when the form submits to itself (I'm assuming that this template is named status2.cfm) you will then have a parm named ArchiveDate containig the user entered date.<br><br>One additional note: If you are accessing the GeneralArchive datasource via ODBC and the SNapshotDate field is a date field not a char field, then your where clause will not work.&nbsp;&nbsp;The date needs to be converted to ODBC format like so:<br><br>WHERE SnapshotDate = #CreateODBCDate(ArchiveDate)#<br>
 
That did the trick. The odbcdate wasn't a problem, but removing the field worked great. Thanks for the help.<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dave<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top