Input validation from client and server sample
Question
Application Type
Reactive

Hi,

Appreciate if anyone of you could help me show me the sample of input validation when onkeypress, onkeyup or onchange from client input and also check again from the server when submit. Because my tester able to "add in" the non accept symbol from some tools. So i need the validate also from the server.


field 1 : not accept @ - ! % and "Spacing" but other symbol is accept.

field 2 : not accept Numeric

field 3 : not accept any symbol but accept alphanumeric

field 4 : not accept any symbol but accept alphanumeric and "spacing".


Able to provide me a sample? easy for me to understand and use.


Thank you


try it with this piece of javascript:


$parameters.OUT = $parameters.IN.replace(/[^a-zA-Z0-9\-_\s]/g, "");

Hi,
jing tung wong

 

Use regex replace for removing spacing and define in regex that which symbols you want in it. 

Use Regex for ^[a-zA-Z\ ^ ${ } [ ] ( ) . + ? | - &]$ and define special character .

Use Regex for ^[a-zA-Z0-9_]*$ for alphanumeric and regex replace.

Use Regex for ^[a-zA-Z0-9_]*$ for alphanumeric and dont use regex replace.

Faiz Khan,

Regards.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.