4 Replies Latest reply on May 27, 2016 8:23 AM by Sanford Whiteman

    How can I change multiple field values with only one select?

    Nick Deboo
      Form
      • First name
      • Last name
      • Email
      • Country
      • I'm a (which is a field called "Lead type")
        • Student | Student
        • Teacher | Lead
        • Other | Lead

       

      How can I change the "Industry" when the visitor chooses "Teacher"? This should write "Education" in there?

        • Re: How can I change multiple field values with only one select?
          Sanford Whiteman
          MktoForms2.whenReady(function(form){
            form.onSubmit(function(form){
              switch (form.getValues()['Lead_Type']) {
                case 'Teacher':
                  form.addHiddenFields({Industry:'Education'});
                  break;
                case 'Some other type':
                  form.addHiddenFields({Industry:'Some other industry});
                  break;
                default:
              }
            });
          });
          

           

          Obviously you need to use the exact names of your fields, which you can see by inspecting the form's HTML or looking in Field Management.

          1 of 1 people found this helpful