- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 12:25 AM
I have created a variable type as single line text but i want that it should only accept numeric values and it should not allow number greater than 10 , how to achieve this with the help of client script
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 12:51 AM
Hi,
Did you try using Validation Regex? you can do this without scripting.
> From your left navigator, open 'Variable validation regex'
> Create a new record with regular expression as \b([0-9]|10)\b
> Give required message.
> Save.
Now open your variable in catalog item
> In Type Specification tab, in validation regex field, select the regex which is created in above steps.
>Done.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 03:26 AM
throwing error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 03:55 AM
i tried this script , but field values are not getting clear on alert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 07:37 AM
You need to remove <> these symbols.
Change this line
g_form.clearValue('<weekly_total_working_hours>');
TO
g_form.clearValue('weekly_total_working_hours');
Mark as correct and helpful if it solved your query.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 12:51 AM
Hi,
Did you try using Validation Regex? you can do this without scripting.
> From your left navigator, open 'Variable validation regex'
> Create a new record with regular expression as \b([0-9]|10)\b
> Give required message.
> Save.
Now open your variable in catalog item
> In Type Specification tab, in validation regex field, select the regex which is created in above steps.
>Done.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 01:33 AM
Hi,
Any update?
Feel free to reach out if you have further questions or else you can mark an answer as correct and helpful to close the thread so that it benefits future visitors also.
Regards,
Sumanth