3 Replies Latest reply on Oct 2, 2014 12:34 PM by BKBK

    Taking user back to a page via captured url date variable

    College Kid

      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>

        • 1. Re: Taking user back to a page via captured url date variable
          BKBK Adobe Community Professional & MVP

          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.

          • 2. Re: Taking user back to a page via captured url date variable
            College Kid Level 1

            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>

            • 3. Re: Taking user back to a page via captured url date variable
              BKBK Adobe Community Professional & MVP

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