Minimum Length for Text Field

Confluence User - 23 Sep, 2016

Hi,

 

Is there a way to set the minimum character length for a text field. There is a maximum but I don't see any options for minimum length. I'm trying to make the user key in a more specific format into a field. 

 

Thanks.

userviews;forms

5


23 Sep, 2016
confluenceUser
confluenceUser

Can't you try using JS on your form?

23 Sep, 2016
confluenceUser
confluenceUser

Hi John Smith

You can try using the "Custom Regular Expression" in "Default Validator" in each form field element properties.

23 Sep, 2016
confluenceUser
confluenceUser

I tried using the below JS in my form however, the process of submitting the form does not stop even with my validation being caught. The form still submits after I click OK on the alert. Am I missing anything essential in order to stop the form from submitting? <script type="text/javascript"> $(document).ready(function() { $('#assignmentComplete').click(function(){ var ulength = FormUtil.getValue("username"); try{ if (ulength.length < 6) { throw "Less than 6 characters"; } } catch(e){ alert("Username is " + e); } }); }); </script>

23 Sep, 2016
confluenceUser
confluenceUser

Is there anywhere I can find examples or a guide on how to use Custom Regular Expressions?

23 Sep, 2016
confluenceUser
confluenceUser

Thanks I found some expressions online that I was able to use.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print