SOLVED

Re: Custom page template marks form field as required

Go to solution
Jessie_Johnson
Level 2

Custom page template marks form field as required

We have a very simple custom page template, and when creating a new page and choosing this, then adding an existing form, it consistently marks the "comment" field as required, even tho this form field is not required. This custom page template is attached. And note that this form was simply cloned from an existing form which DID have the comment field required.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom page template marks form field as required

Yep, but it's not JS, just CSS. The <div> always exists in the DOM even for non-required fields. There's custom CSS unhiding it.

pastedImage_1.png

View solution in original post

12 REPLIES 12
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom page template marks form field as required

Not sure why you're attributing this to the template. Please show the form setup. Ensure that both the form and the LP with the form selected have been reapproved.

Jessie_Johnson
Level 2

Re: Custom page template marks form field as required

Only when the form is embedded in this form does the last field appear as required.

SanfordWhiteman
Level 10 - Community Moderator

Re: Custom page template marks form field as required

We need to see the entire form. Please provide the embed code. There's nothing on that template that does anything special.

Jessie_Johnson
Level 2

Re: Custom page template marks form field as required

Form embed is just:

<script src="//app-ab20.marketo.com/js/forms2/js/forms2.min.js"></script>

<form id="mktoForm_1417"></form>

<script>MktoForms2.loadForm("//app-ab20.marketo.com", "682-DBU-809", 1417);</script>

But form is being called through Marketo, not embed.

SanfordWhiteman
Level 10 - Community Moderator

Re: Custom page template marks form field as required

Now a link to an approved LP showing the behavior.

Jessie_Johnson
Level 2

Re: Custom page template marks form field as required

Amit_Jain
Level 8 - Community Advisor

Re: Custom page template marks form field as required

Agree with Sanford here.

Also check on the form if you have any custom JS code which is making all the fields on the form as "Required".

Jessie_Johnson
Level 2

Re: Custom page template marks form field as required

None

Corey_Bethel
Level 4 - Champion Alumni

Re: Custom page template marks form field as required

The comments field only appears to be "required", but the form will submit without that field being populated. Also, the comments field is missing the "mktoRequired" class that would actually make it required. I'd say there is some custom JS that is adding the div with the "mktoAsterix" class, which is why it appears to be required.

Corey Bethel
Consultant | Etumos