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

snow34
Tera Contributor

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 

1 ACCEPTED SOLUTION

SumanthDosapati
Mega Sage
Mega Sage

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

 

 

 

View solution in original post

9 REPLIES 9

 throwing error

i tried this script , but field values are not getting clear on alert

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

SumanthDosapati
Mega Sage
Mega Sage

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

 

 

 

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