Limit the single line text variable with a minimum of 3 characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 03:20 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 03:38 AM - edited 05-13-2024 03:39 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 04:51 AM
@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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 05:19 AM - edited 05-13-2024 05:20 AM
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');