- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 01:11 AM
Hello Team,
I am setting a catalog item variable's max length is 50 characters but it's not working, the field still allow more than 50 characters. Please a way to fix it?
Thanks,
Prudhvi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 01:50 AM
Try this in onload client script
g_form.getControl('var_name').setAttribute('maxlength', 20);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 01:29 AM - edited 01-23-2023 01:30 AM
Hi @Prudhvi Raj4 ,
The max_length is only applicable to variables: Single-line text, Wide single-line text.
Did you opt for these variables or other variables.
If you've opted for other variables then it needs to be done via onchange client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 01:45 AM
I am using single line text only but not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 01:50 AM
Try this in onload client script
g_form.getControl('var_name').setAttribute('maxlength', 20);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 02:12 AM
Hi,
If use same code on the variable set it's giving me "JavaScript error" on the portal setAttribute is not supported on the variable set client scripts?
Thanks,
Prudhvi