2 Replies Latest reply on Jun 18, 2007 1:48 PM by insuractive

    OnSubmit in Forms to Control Action

      I'm using cfform within a MX7 environment. The form contains a RadioButton set up with 1 of 3 choices. Is there a way I can use OnSubmit to control the Action Field so that If RadioButton 1 is selected then the Action URL is Page_1 and if 2 then it goes to Page_2 etc.

      If so how would it work?

      Thanks for any help.
        • 1. Re: OnSubmit in Forms to Control Action
          Level 7
          you will have to use javascript for that.
          put an onClick event in your radio buttons with a function to change the
          form's action attribute.
          i believe onSubmit event of the form will be too late to change the
          action page...

          • 2. Re: OnSubmit in Forms to Control Action
            insuractive Level 3
            Since onSubmit() fires prior to the actual form submission, you can use it to redirect the action page. We actually do this on a couple of pages. Just reference .action="" as you would any other form field:

            if (document.myForm.myRadioButton[0].checked == true) {
            document.myForm.action = "someOtherPage.cfm";
            else if (document.myForm.myRadioButton[1].checked == true) {
            document.myForm.action = "someOtherPage2.cfm";
            else {
            document.myForm.action = "someOtherPage3.cfm";