SOLVED

Show TWO new form fields dynamically

Go to solution
Anonymous
Not applicable

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
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

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();


View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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();


Anonymous
Not applicable

Re: Show TWO new form fields dynamically

Thanks, Erik. I was able to get it to work.