• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Taking user back to a page via captured url date variable

Explorer ,
Sep 30, 2014 Sep 30, 2014

Copy link to clipboard

Copied

I have a page that will delete the contents of a database column. After the column is deleted, The page will take the the end user back to a page that displays a list of program attendees. I am trying to create a variable within the delete page, via a self-submitting form, to redirect the user back to the original page which has the list of members in attendance minus the deleted member. This member attendance page is dynamically created via a query wherein an entered date will show the list of attendance for the selected date. So I am thinking that I need to populate the date box of the original list by way of the self submitting form with an input box of the same name. The original attendance list from where The attendance is populated comes from a form that only has a date that is in the field. What is below shows the syntax for the delete column Page. When I do the code below it throws an error. 

<!---Capture Date from the url variable---><cfquery name="capture_date" datasource="master">

SELECT meeting.meedate FROM meeting where meedate = '#URL.meeid#'

</cfquery>

<!---Delete member from meeting table ariable--->

<cfif IsDefined("URL.meeid") AND #URL.meeid# NEQ "">

  <cfquery datasource="master">

    DELETE FROM meeting

WHERE meeid=<cfqueryparam value="#URL.meeid#" cfsqltype="cf_sql_numeric">

  </cfquery>

</cfif>

<!---Take user back to attendance page via captured url variable--->

<cfform action="insert_attendance1_clone.cfm" method="post" name="form">

<cfinput name="squweekbegin" type="hidden" value="#capture_date.meedate#" />

</cfform>

<script>

document.form.submit();

</script>

Views

414

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 02, 2014 Oct 02, 2014

Copy link to clipboard

Copied

College Kid wrote:

When I do the code below it throws an error. 

Please give us as much information as you can about the error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 02, 2014 Oct 02, 2014

Copy link to clipboard

Copied

The error came when after the deletion of a record, I tried to capture the date of the record that was just deleted and pass that date on to the original page. The day was not captured and the error was thrown saying that the day did not exist. I ended up doing a cfcookie and capturing the date in a different way and holding that cookie date as a value that is being passed to the original page. The code that I used that help to solve the issue is below. This may be Crude work-around however it works for now. Could there be a easier quicker way to work this. Although this works just fine it takes about 10 to 11 seconds for the page to pass through back to the original page. Here is my code below.

<cfif IsDefined("URL.meeid") AND #URL.meeid# NEQ "">

  <cfquery datasource="master">

    DELETE FROM meeting

WHERE meeid=<cfqueryparam value="#URL.meeid#" cfsqltype="cf_sql_numeric">

  </cfquery>

<!---  <cflocation url="insert_attendance1_clone.cfm">--->

</cfif>

<cfform action="insert_attendance1_clone.cfm" method="post" name="form">

<cfinput name="squweekbegin" type="hidden" value="#cookie.constantdate#" />

</cfform>

<script>

document.form.submit();

</script>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 02, 2014 Oct 02, 2014

Copy link to clipboard

Copied

LATEST

You seem to have solved the problem. There is nothing I can add to your code, except perhaps <script type="text/javascript">.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation