You are viewing limited content. For full access, please sign in.

Question

Question

Forms 11 update 3 character limit for Other choice

asked on June 5, 2023

In the old designer you could use JS to limit the number of characters in the Other option for radio and checkboxes.  Does/Will 11 have this option since JS is limited?  

2 0

Answer

SELECTED ANSWER
replied on June 5, 2023

I know it's not ideal for every situation - but I usually end up using a separate field for Other, and using Field Rules to show/hide it.  It just gives more control over appearance and functionality than the built-in other field on the checkboxes.

0 0
replied on June 5, 2023

That was the only solution I could come up with which is fine, its just one more field I didnt want to have to mess with if possible.

1 0

Replies

replied on June 6, 2023

A potential solution would be using built in onFieldChange and getFieldValue functions to limit the value like this:

function limitOtherChoice(fieldId, limit) {
  let fieldValue = LFForm.getFieldValues({fieldId: fieldId});
  if (fieldValue.otherChoiceValue && fieldValue.otherChoiceValue.length > limit) {
    fieldValue.otherChoiceValue = fieldValue.otherChoiceValue.substring(0, limit);
    
    LFForm.setFieldValues({fieldId: fieldId}, fieldValue);
  }
}

LFForm.onFieldChange(function(){
  limitOtherChoice(1, 10);
}, {fieldId: 1});

But it would still allow user to type more than limit and then remove the extra chars after change is triggered.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.