Limit the single line text variable with a minimum of 3 characters

Sanafelix1323
Tera Contributor

Hi every one

 

I want to set a restriction of having a minimum of 3 letters to a single line text or else show a error to enter minimum required characters to the filed.

 

For maximum length of the filed I have already used the variable attribute filed max_length=30

Please help me out with the minimum letters to be entered into the text box.

3 REPLIES 3

Amit Pandey
Kilo Sage

Hi @Sanafelix1323 

 

You need to create onChange client script. Sample script is-

 

 

var field = g_form.getValue('your_field_name'); 
 if (field.length < 3) {
        alert('Enter at least 3 characters in field'); 
         } 

 

Please mark my answer helpful and correct.

 

Regards,

Amit

@Amit Pandey  I want to know like can't we show this as a filed error message which will be visible in the employee center portal .

Hi,

How do you want to show the message?

You an add alert of field message, same way as Amit showed. Examples below

g_form.showFieldMsg('impact','Low impact response time can be one week','info');
//or this defaults to info type
//g_form.showFieldMsg('impact','Low impact response time can be one week');
 
-Anurag