SOLVED

Re: form with a drop down field that is required

Go to solution
mrkcrne
Level 2

form with a drop down field that is required

I'm new to Marketo and my form that has a drop down can be submitted without the drop down being selected by a user. We currently have "Select" as the default value, so I assume that is why it is allowing the submission, so is there a way around this?

1 ACCEPTED SOLUTION

Accepted Solutions
Jo_Pitts1
Level 10 - Community Advisor

Re: form with a drop down field that is required

@mrkcrne ,

ultimately, if you have no value in the 'select' option, Marketo will display an error anyway when someone moves through the field, or tries to submit the form.

 

To make that work, you need to get rid of the value in the red box.  

Jo_Pitts1_0-1644280636550.png

 

If you placed your form (configured as you showed it in the screen shot of your drop down options) on a test landing page, this would happen natively, as you've got no entry for the stored value.

 

To prove this, I inspected the form elements and altered the select option for industry.

Jo_Pitts1_0-1644281077391.png

 

When I tried to submit the form I got this error

Jo_Pitts1_1-1644281098784.png

 

Talk to your dev team about WHY what they are doing is adding in the value="select" instead of leaving as value="", and could they please stop.

Cheers

Jo

 

View solution in original post

13 REPLIES 13
SanfordWhiteman
Level 10 - Community Moderator

Re: form with a drop down field that is required

You have to mark the field as Required in Form Editor.

The "Select..." with an empty server value is not a valid selection if it's Required.
mrkcrne
Level 2

Re: form with a drop down field that is required

Thanks, I have the filed marked as required and this is how the choices are set up. But it isn't working as I can submit this field without selecting a drop down value.

Screen Shot 2022-02-07 at 1.05.46 PM.png

SanfordWhiteman
Level 10 - Community Moderator

Re: form with a drop down field that is required

That’s not expected behavior. You’ll need to provide a link to your page to troubleshoot further. Required means the server value can’t be empty.
mrkcrne
Level 2

Re: form with a drop down field that is required

https://www.vicorpower.com/home/z-work-in-progress/get-updates

 

Both Role and Industry are a required field.

SanfordWhiteman
Level 10 - Community Moderator

Re: form with a drop down field that is required

That's not the same form as in your screenshot. One has "Select..." with an ellipsis and the other "Select".
mrkcrne
Level 2

Re: form with a drop down field that is required

Hey Sanford, maybe this isn't the correct place for this, but I can assure you that this is the correct form. We are doing a lot with some js code in our CMS, we support 4 languages and we are using the language switcher on our site to make sure that the form is in the correct language. We also have a custom CSS to make our forms conform with our site. Not sure if you want to look at the custom js or if that is asking to much.

SanfordWhiteman
Level 10 - Community Moderator

Re: form with a drop down field that is required

If you're using JS to dynamically change the options so the topmost option has different inner text and has a value, then in practice it's not the same form.

 

As you can see, its value is the string "Select", not the empty string:

 

SanfordWhiteman_0-1644266496334.png

 

I put that form's embed code, without your customizations, in a CodePen. You'll see the form cannot be submitted when the topmost option, with the display text "Select...", is selected:

 

https://cdpn.io/pen/debug/mdqRwKy/4465a9bceacc125ecc2fad54f5ca6901

 

mrkcrne
Level 2

Re: form with a drop down field that is required

Thanks for all the help, this is interesting as the "Role" looks like it is requited but the "Industry" is not. I just clicked the submit button and the red outline showed up around the "Role" field but not the "Industry" field. The industry field is also required.

SanfordWhiteman
Level 10 - Community Moderator

Re: form with a drop down field that is required

Again, you can see that the option has a value:

 

SanfordWhiteman_0-1644268549794.png