SOLVED

Re: Same form but only split completion count if certain field is filled.

Go to solution
Callum_Pirie
Level 3

Same form but only split completion count if certain field is filled.

Hi there,

I hope this makes sense. I have a form on our website which is below

2.png

is there a way to run the same form above but only count the completion as a contact request if the query box is populated at all?

Here are the hidden fields we have:

4.png

and for Account Source its B2B Partnership Enquiry so we know someone used the Enquiry form on the website however the other form we have with similar fields are just called 'Brochure Download'

If I was to have Account Source: B2B Partnership Enquiry and Person Source: B2B Partnership Enquiry and then below that Account Source II: Brochure Download and Person Source II: Brochure Download could I then jump in the if statement area and make this happen?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Same form but only split completion count if certain field is filled.

Your phrasing is unclear: what do you mean by "jump in the if statement area"?

If you mean the Visibility Rules list, then no, you can't set a field's value using VRs.

Do you want to only populate a certain field if another field is non-empty, you must use JS.

MktoForms2.whenReady(function(form){
  form.onSubmit(function(form){
    var currentValues = form.getValues();

    if (currentValues.someVisibleTextField != "") {

      form.addHiddenFields({

        isSomeKindOfInterestingRequest : "Yep, it's interesting"

      });

    }

  });

});

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Same form but only split completion count if certain field is filled.

Your phrasing is unclear: what do you mean by "jump in the if statement area"?

If you mean the Visibility Rules list, then no, you can't set a field's value using VRs.

Do you want to only populate a certain field if another field is non-empty, you must use JS.

MktoForms2.whenReady(function(form){
  form.onSubmit(function(form){
    var currentValues = form.getValues();

    if (currentValues.someVisibleTextField != "") {

      form.addHiddenFields({

        isSomeKindOfInterestingRequest : "Yep, it's interesting"

      });

    }

  });

});

Callum_Pirie
Level 3

Re: Same form but only split completion count if certain field is filled.

Hi Sanford,


Thanks for this -