SOLVED

Re: Can you make selector item non selectable in drop-down list?

Go to solution
Leanne_Persang
Level 4

Can you make selector item non selectable in drop-down list?

I have an event that people can register for, but only a number of people can register for each session. Once a session becomes full, I'd like to update the selector... does it make sense to just remove it? My concern with deleting it was there would be a jump from session 5 to session 7, for example. Or, am I able to keep it but make it not selectable?

For now, I changed the wording... but technically people can still select it and submit.

pastedImage_0.png

And, what is best practice? I am sure this has been done before!

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
hclark
Level 1

Re: Can you make selector item non selectable in drop-down list?

If anyone else finds their way here and can't figure out why it won't work...make sure you add a space after "[DISABLED]" in the Display Value editor. The script matches a string that starts with [DISABLED] followed by a whitespace character. Took me longer than I care to admit to figure this out...so commenting incase this helps out someone else!

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you make selector item non selectable in drop-down list?

Thanks for updating. Good to see people still using the code after all that time!

 

Btw, I just made a little change to the code because some things are browser-native now compared to 2017.

View solution in original post

13 REPLIES 13
Grégoire_Miche2
Level 10

Re: Can you make selector item non selectable in drop-down list?

Hi Leanne,

This can be done with some JS that will check the event is full and deactivate the value. It will require to pass the info to the page, though, which is not that easy. The most reliable way of doing it is through a webservice platform that can 1/ track the number of registrants and 2/ be called by the form when it's loading and notify the form to deactivate some values.

If you want to change the numbering dynamically, you will also need some JS.

-Greg

Sanford WhitemanDiederik Martens Rajesh Talele

Leanne_Persang
Level 4

Re: Can you make selector item non selectable in drop-down list?

Ah, I thought it would (but was hoping it wouldn't, ha) require JS. It would be nice if in the Marketo selector editor there was an option to check to deactivate an item from the list.

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you make selector item non selectable in drop-down list?

Disabling the <OPTION> in the dropdown and counting registrants are actually two different concerns. Related, to be sure -- but even if the second is automated the first still requires that the forms behaviors be enhanced.

 

You don't have to write the JavaScript, though, since I just did for you.

 

Just change the Display Value in Form Editor:

 

pastedImage_2.png

 

Then include the tiny bit of JS demoed here:

 

MktoForms2 :: Disable Options

Grégoire_Miche2
Level 10

Re: Can you make selector item non selectable in drop-down list?

This one is really cool !

-Greg

Kevin_Stinson
Level 3

Re: Can you make selector item non selectable in drop-down list?

Hi Sanford

I have tried this code out but I can't get it working. The form displays  [DISABLED] in the select field and it is selectable. See image:

pastedImage_1.png

I dropped the javascript in the head of a Marketo landing page and put the form on the page.

Am I missing a step?

thanks,

Kevin.

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you make selector item non selectable in drop-down list?

Can't go in the head, for one. On a Marketo LP, forms JS needs to go just before the end of the body 

Kevin_Stinson
Level 3

Re: Can you make selector item non selectable in drop-down list?

Thanks Sanford that change made it work.

hclark
Level 1

Re: Can you make selector item non selectable in drop-down list?

If anyone else finds their way here and can't figure out why it won't work...make sure you add a space after "[DISABLED]" in the Display Value editor. The script matches a string that starts with [DISABLED] followed by a whitespace character. Took me longer than I care to admit to figure this out...so commenting incase this helps out someone else!

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you make selector item non selectable in drop-down list?

Thanks for updating. Good to see people still using the code after all that time!

 

Btw, I just made a little change to the code because some things are browser-native now compared to 2017.