Validation on comma separated values

KARAN24
Tera Contributor

Hi Team,

 

I have a requirement,

We have a catalog item,where we have one variable called as'TAX ID' which is single line text field.

so users should enter the TAX ID manually,and after that we have to validate whether the 'tax id ' entered is correct or not,We are getting the 'TAX ID' from integration and is stored in tax table.

 

So,whenever users enter the 'TAX ID' manually we have to validate if the entered value is present in the table or not.

 

Issue is some values in the Tax table are stored as comma separated values as shown below:

KARAN24_0-1672732045455.png

But the users can enter only one value,so how to validate that.

 

Thank,

Karan

6 REPLIES 6

Hi Sandeep,

Thanks for your response,but mine issue is :

 

I have this Tax ID Column in Tax table ,here the values are comma separated.

KARAN24_0-1672739752180.png

But user can enter only one Tax ID ,suppose if the user enters 789,then also it should validate and user should be able to submit the form.How this can be done.

 

Thanks,

Karan

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @KARAN24 ,

You can try removing the comma from the number and try carrying out validation

 x = parseInt(x.replace(/[,]/g,''));

Thanks,

Omkar 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.