2 Replies Latest reply on Jul 11, 2013 1:02 PM by 32979

    Show TWO new form fields dynamically

      I want to expand my form dynamically showing TWO new fields.

      I currently use the java (link below) in order to show just ONE extra field. I'm no java expert but would love to know how I can add a second field to the java that I'm currently using.

      http://community.marketo.com/MarketoArticle?id=kA050000000KyqqCAC

      Thanks
        • Re: Show TWO new form fields dynamically
          I think you'd just copy part of it again and change the field names. So you'd have two blocks like there are below, but change the field names and the variable names (e.g. websiteRow):

          var websiteRow = $jQ("#Website").parents("li:first");
            var websiteField = $jQ("#Website");

             // when the triggering field changes...
            $jQ("#Yesorno").change(function() {
              var value = this.value;

               // when "Yes", show the dynamic field and make it required
               // when "No", hide the dynamic field
              switch(value)
              {
                case "Yes":
                   websiteField.addClass("mktFReq");
                   websiteRow.addClass("mktFormReq").slideDown();
                   break;

                default:
                   websiteRow.removeClass("mktFormReq").slideUp();
                   websiteField.removeClass("mktFReq");
              }
            }).change();


          • Re: Show TWO new form fields dynamically
            Thanks, Erik. I was able to get it to work.