9 Replies Latest reply on Feb 12, 2009 7:24 AM by CFmonger

    Passing a variable, and losing it in java scripting. Please help

    CFmonger
      Hello;
      I am upgrading a lot of my code to cf 8, some of it was running on old code. I made a lot of serious changes and I ran into a problem in doing things this way.

      Here is what I am trying to do.

      I have an app that has a number of different pages doing a number of different things, adding records, inserting new ones an so on. I made 1 page called action.cfm this page has all my controls on it for all these sections of the app. To set off the appropriate code, I am using an if statement like this:

      <cfif isDefined("Form.EventView_Edit")>
      and it sets off the code for that form. the submit button on the form is called: EventView_Edit

      Now, I am trying to pass this information through a java script I use to ask you if you really want to delete a record.

      This is that script:
      <script language="JavaScript">
      function confirmDelete(ID_Field,ViewField1) {
      if (confirm ("Are you sure you want to delete " + ViewField1 + " event?"))
      {
      document.HREF.action="ProjectCat-Action.cfm?id="+id;
      document.HREF.submit();
      }
      return false;
      }
      </script>

      This is parts of the form, passing the info.

      <form action="Action.cfm" method="post">
      <input type="submit" class="formButtons" name="EventView_Edit" value="Delete">
      </form>

      It was working fine when I had this secrions operators on it's own page, but now that I am narrowing it down with a lot of code for a number of items, it is missing the delete function because the name of the form button is not passing through the java.

      How do I fix this?
      Also, is there a better way of doing what I am doing? Or is this pretty much it?

      Thank you.
      CFmonger