I have a form/action page set that allows users to create a record for past work weeks. The premise is simple. If they are the first one to create a work week record, fine it is created and then a CFLOCATION tag takes them to a Task page where they can add the tasks they hace completed. It works fine.
Now, I have CFIF logic built in that determines whether someone has created a record for that week already. If someone has, they get a message alerting them and offering them a chance to add another task to that week's data, or to view a list of all the weeks submitted. This is where my problem starts.
Everything works right up until the CFELSE statement. I can't get the ID to pass to the URL link after the CFELSE. I want the ID to pass so the task page can query the proper record and allow the user to input against that ID. But it won't pass, and I'm confused as to why not.
Here's my code for the action page:
----------------------------
<!--- param values --->
<cfparam name="report_id" default="report_id">
<!-- The CFSet will create an input from for the marker field in the 'Report' table that can be queried for the insertion of the tasks. -->
<CFSET temp = Rand()>
<CFQUERY NAME="CheckForm" DATASOURCE="#REQUEST.DataSource#">
select period
from report
where period = '#form.period#'
</CFQUERY>
<!-- The CheckForm query uses '#form.period#' to determine whether a record has been created for a given period. If one has, the validation CFIF statement directs the user to a page with a choice of 'Add tasking' or 'View List.' -->
<CFIF CheckForm.RecordCount EQ "0">
<!--- Use CFQUERY to insert all html form field values into the Report table --->
<CFQUERY DATASOURCE="#REQUEST.DataSource#">
INSERT INTO report
(period, marker)
VALUES
('#Form.period#', '#temp#')
</CFQUERY>
<cfquery name="qGetitBack" DATASOURCE="#REQUEST.DataSource#">
select report_id
from report
where marker = '#temp#'
</CFQUERY>
<CFLOCATION URL="t3i_add_form_task.cfm?report_id=#qGetitBack.report_id#">
<CFELSE>
A Weekly Report for this Period has already been created. You cannot create another record for this Period, but you can add your taskings to this one. <br><br>
Would you like to:<br><br><CFOUTPUT>
<a href="t3i_add_form_task.cfm?report_id=#report_id#">Add Tasking:</a></CFOUTPUT>
<br><br>
<a href="..\report_list.cfm"><font color="##000099">View Report:</font></a>
</CFIF>
-----------------------
Any help is appreciated.
Now, I have CFIF logic built in that determines whether someone has created a record for that week already. If someone has, they get a message alerting them and offering them a chance to add another task to that week's data, or to view a list of all the weeks submitted. This is where my problem starts.
Everything works right up until the CFELSE statement. I can't get the ID to pass to the URL link after the CFELSE. I want the ID to pass so the task page can query the proper record and allow the user to input against that ID. But it won't pass, and I'm confused as to why not.
Here's my code for the action page:
----------------------------
<!--- param values --->
<cfparam name="report_id" default="report_id">
<!-- The CFSet will create an input from for the marker field in the 'Report' table that can be queried for the insertion of the tasks. -->
<CFSET temp = Rand()>
<CFQUERY NAME="CheckForm" DATASOURCE="#REQUEST.DataSource#">
select period
from report
where period = '#form.period#'
</CFQUERY>
<!-- The CheckForm query uses '#form.period#' to determine whether a record has been created for a given period. If one has, the validation CFIF statement directs the user to a page with a choice of 'Add tasking' or 'View List.' -->
<CFIF CheckForm.RecordCount EQ "0">
<!--- Use CFQUERY to insert all html form field values into the Report table --->
<CFQUERY DATASOURCE="#REQUEST.DataSource#">
INSERT INTO report
(period, marker)
VALUES
('#Form.period#', '#temp#')
</CFQUERY>
<cfquery name="qGetitBack" DATASOURCE="#REQUEST.DataSource#">
select report_id
from report
where marker = '#temp#'
</CFQUERY>
<CFLOCATION URL="t3i_add_form_task.cfm?report_id=#qGetitBack.report_id#">
<CFELSE>
A Weekly Report for this Period has already been created. You cannot create another record for this Period, but you can add your taskings to this one. <br><br>
Would you like to:<br><br><CFOUTPUT>
<a href="t3i_add_form_task.cfm?report_id=#report_id#">Add Tasking:</a></CFOUTPUT>
<br><br>
<a href="..\report_list.cfm"><font color="##000099">View Report:</font></a>
</CFIF>
-----------------------
Any help is appreciated.