I need to add a parameter to a specific field in a WFFM form. This is a standard sitecore field, not a custom field type, so I cannot change or extend the model to include another "setting".

The parameter needs to be able to be picked up by some JS code on the form page.

The reason for this is that the Listbox fieldtype doesn't have a way of restricting the number of selected options, only if it's single or multiple select. The parameter "MaximumSelects" should therefore be read by JS and restrict the number of selects that way.

Note: Since we have editors with no programming knowledge that's gonna use this, the solution should not be more complicated than adding "MaximumSelects=2" or "2" somewhere in the form settings.

The project already have a lot of custom field types and to make a new field type that's basically a copy of the Listbox only with a max select option would be close to impossible due to strict guidelines.

  • You are either going to have to create a new fields type and add a validator, or get creative and maybe use a CSS class on the field, which can then trigger some restrictions/validation using JS on the front-end. – jammykam Aug 28 '19 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.