SOLVED

Re: Can we build two step form in marketo by using custom JavaScript?

Go to solution
debbie_917
Level 2

Re: Can we build two step form in marketo by using custom JavaScript?

@SanfordWhiteman 
One more thing. It's not a HUGE issue, but after clicking submit. Both buttons say "Please Wait" Is there a way to have the back button hide after submit?
https://codepen.io/debbie_917/pen/KKYdeJR

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Can we build two step form in marketo by using custom JavaScript?

MktoForms2.whenReady(function(readyForm){
  readyForm.onSubmit(function(submittingForm){
    submittingForm.getFormElem().find("button.mktoButton[data-dir='prev']").hide();
  });
});
debbie_917
Level 2

Re: Can we build two step form in marketo by using custom JavaScript?

Thank you @SanfordWhiteman! Have a wonderful day.

AKR
Level 1
Level 1

Re: Can we build two step form in marketo by using custom JavaScript?

@SanfordWhiteman 

I have used the CSS and JS as per given instructions and it worked very well. 
In my web-form I have checkboxes type fields which needs to be mandatory. I have added the fields name in JS but its not working.

Could you please guide how to make the checkboxes filed mandatory along with the other fields.

SanfordWhiteman
Level 10 - Community Moderator

Re: Can we build two step form in marketo by using custom JavaScript?

You have to link to your page. That’s not enough to go on.

AKR
Level 1
Level 1

Re: Can we build two step form in marketo by using custom JavaScript?

Hi @SanfordWhiteman ,

 

I have this test form where we have radio buttons and checkboxes type fields. 

I have modified the JS for the required fields, its working fine for radio buttons, but when I add the checkboxes fields to make them required in the CSS then web-form doesn't appear. Could you please help how checkboxes fields can be mandatory?

requiredFields: [
{
name: "surveyQuestion1",
message: "This field is required."
},
{
name: "surveyQuestion20",
message: "This field is required."
}, ]
SanfordWhiteman
Level 10 - Community Moderator

Re: Can we build two step form in marketo by using custom JavaScript?


its working fine for radio buttons, but when I add the checkboxes fields to make them required in the CSS then web-form doesn't appear. Could you please help how checkboxes fields can be mandatory?


Is it? Or do you just have that field marked Required in Form Editor?

 

You need to take the config block/code out of the Rich Text area, that’s impossible to troubleshoot (and also gives unexpected results, as I’ve written about before).

AKR
Level 1
Level 1

Re: Can we build two step form in marketo by using custom JavaScript?



Is it? Or do you just have that field marked Required in Form Editor?

Hi @SanfordWhiteman - No, Required option is unchecked for all the fields on form level.

You need to take the config block/code out of the Rich Text area, that’s impossible to troubleshoot (and also gives unexpected results, as I’ve written about before).

I have removed the config block from Rich text area and added on landing page meta tag, I hope that would be fine?

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Can we build two step form in marketo by using custom JavaScript?


have removed the config block from Rich text area and added on landing page meta tag, I hope that would be fine?


No, it needs to be just before the closing </body> tag.

Jay_Jiang
Level 10

Re: Can we build two step form in marketo by using custom JavaScript?

In short yes it can be done.

If you're struggling with a marketo only form, and all else fails, build your own form and submit the answers to marketo in the background