Question
handling form data
Hi all,
i will first xplain the situation:
i have page1 which sends 3 form data like year , date , name to page2 , in page2 im getting the form date(from page1) and store that data in new variables, In page 2 i have a form there i am using three hidden fileds for passing the data from the previous page(page1) to the same page because my query changes with the url data.Iam getting an error saying month2 is not defined in form, can anyone help me out, i appreciate any new ideas.
Thanks in advance
here is the code :
<cfquery name="getWinners1" datasource="FMA_REPORTS" >
select convert(char,f.monthYear,101)as date
, r.run_start_date as date ,r.run_name as runname,w.fir_name as first,w.last_name as last from fm_run r, wdl_empl w, fm_eng_winners f
where 0=0 and f.empl_id=w.empl_id and r.run_id=f.run_id
<cfif #runname1# is not " ">
and r.run_name_ecount= '#runname1#'
</cfif>
<cfif #year1# is not "00">
and datepart(yyyy,f.monthYear)=#year1# </cfif>
<cfif #month1# is not "00">
and datepart(mm,f.monthYear)=#month1#</cfif>
<cfif #orderby1# is not "" >
and order by #orderby1#</cfif>
</cfquery>
the runname , year1, month1 are from page1(i used cfset month1=#form.month#>)
My form:
<cfform name="Rankings" action="new_ra.cfm" method="post" preservedata="no">
<input type="hidden" value="#runname1#" name="runname2">
<input type="hidden" value="#year1#" name="year2">
<input type="hidden" value="#month1#" name="month2">
<cfoutput>
checking the input fields: value="#runname1#"
</cfoutput>
<cfif #getWinners1.RecordCount# NOT EQUAL 0 >
<table border="=1">
<tr><td><a href="new_ra.cfm?orderby=run_name" onClick="javascript: submitform()">RUN NAME</a></td><td><a href="new_ra.cfm?orderby=first" onClick="javascript: submitform()">FIRST NAME</a></td><td><a href="new_ra.cfm?orderby=last" onClick="javascript: submitform()"></a> LAST NAME</td><td colspan="2"><a href="new_ra.cfm?orderby=date">DATE</a></tr>
<cfoutput query=getWinners1>
<tr><td>#runname#</td><td>#first#</td><td>#last#</td><td>#date#</td></tr>
</cfoutput>
</table>
</cfform>
Error message:
Element MONTH2 is undefined in FORM.
The error occurred in /content/employees/htdocs/emp/operating/tey/fuel_masters/reporting/new_ra.cfm: line 3
1 : <cfif Isdefined("URL.orderby")>
2 : <cfoutput>
3 : Text form month2 value="#Form.month2#"
4 : form year value= #form.year2#
5 : orderby =#URL.orderby#</cfoutput>
i will first xplain the situation:
i have page1 which sends 3 form data like year , date , name to page2 , in page2 im getting the form date(from page1) and store that data in new variables, In page 2 i have a form there i am using three hidden fileds for passing the data from the previous page(page1) to the same page because my query changes with the url data.Iam getting an error saying month2 is not defined in form, can anyone help me out, i appreciate any new ideas.
Thanks in advance
here is the code :
<cfquery name="getWinners1" datasource="FMA_REPORTS" >
select convert(char,f.monthYear,101)as date
, r.run_start_date as date ,r.run_name as runname,w.fir_name as first,w.last_name as last from fm_run r, wdl_empl w, fm_eng_winners f
where 0=0 and f.empl_id=w.empl_id and r.run_id=f.run_id
<cfif #runname1# is not " ">
and r.run_name_ecount= '#runname1#'
</cfif>
<cfif #year1# is not "00">
and datepart(yyyy,f.monthYear)=#year1# </cfif>
<cfif #month1# is not "00">
and datepart(mm,f.monthYear)=#month1#</cfif>
<cfif #orderby1# is not "" >
and order by #orderby1#</cfif>
</cfquery>
the runname , year1, month1 are from page1(i used cfset month1=#form.month#>)
My form:
<cfform name="Rankings" action="new_ra.cfm" method="post" preservedata="no">
<input type="hidden" value="#runname1#" name="runname2">
<input type="hidden" value="#year1#" name="year2">
<input type="hidden" value="#month1#" name="month2">
<cfoutput>
checking the input fields: value="#runname1#"
</cfoutput>
<cfif #getWinners1.RecordCount# NOT EQUAL 0 >
<table border="=1">
<tr><td><a href="new_ra.cfm?orderby=run_name" onClick="javascript: submitform()">RUN NAME</a></td><td><a href="new_ra.cfm?orderby=first" onClick="javascript: submitform()">FIRST NAME</a></td><td><a href="new_ra.cfm?orderby=last" onClick="javascript: submitform()"></a> LAST NAME</td><td colspan="2"><a href="new_ra.cfm?orderby=date">DATE</a></tr>
<cfoutput query=getWinners1>
<tr><td>#runname#</td><td>#first#</td><td>#last#</td><td>#date#</td></tr>
</cfoutput>
</table>
</cfform>
Error message:
Element MONTH2 is undefined in FORM.
The error occurred in /content/employees/htdocs/emp/operating/tey/fuel_masters/reporting/new_ra.cfm: line 3
1 : <cfif Isdefined("URL.orderby")>
2 : <cfoutput>
3 : Text form month2 value="#Form.month2#"
4 : form year value= #form.year2#
5 : orderby =#URL.orderby#</cfoutput>