field minimum length

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have an input that I want to require a minimum of 6 characters.  Can I hide the enter button if the field is 5 or less characters in length?  How do I determine the number of characters typed?
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I think you can set a Salesforce validation rule on the field using the LEN function to require the field to have a certain number of characters.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi Bill -

This is possible although not as easy as you would like it to be unfortunately.  That said, it's still rather straightforward.  Here are your options:

1) Wait for Skuid to add a LENGTH formula function.  If this existed, you could add a UI Only field that applied the LENGTH function.  From there, you could setup conditional rendering for the button on the UI Only field.  As far as I know, there is not a community post asking for LENGTH function so I'd recommend you submit one if you would like to see this.

2) Wait for Skuid to add "Custom Formulas".  If this existed, you could add your own LENGTH function and use it in your UI only field and then setup conditional rendering.  I've been pushing for this to be added for a while now.  If this is something you'd like to see, vote up the issue at https://community.skuid.com/skuid/topics/add-support-for-registering-custom-formulas.

3) Custom JS Solution - This is really your only choice currently.  To implement, do the following:
a) Add a UI Only field to your model of type numeric
b) Add a JS snippet that calculates the length of the field that you want to track and updates the UI Only field created in step 'a'
c) Add an action handler to Model Changed for the field that you want to track the length on and call the snippet from 'b'
d) apply conditional rendering to the button using the value of the UI only field from 'a'

Hope this helps!
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb
Thank you Raymond and Barry.  I vote for 1 or 2, I will wait.