Link to home
Start Free TrialLog in
Avatar of mrslate1
mrslate1

asked on

How to automatically render & to & in form text field

Hi, I am attempting to work through users potentially replacing a typed & which in our code is not allowed, with & either using JavaScript or the like. We wish to have it converted when the user hits the send button to search a database for reporting data.

Some of the code that we have used for this purpose has failed, and it seems to me it  should be a simple if then statement upon send. But I'm not sure of the correct syntax.

Does anyone have code, and possibly a working example? I would very much appreciate any help.

Thank you in advance

Todd
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
JavaScript validation is useful but not a replacement for server side validation. The latter is necessary if you want to guarantee that what you are hitting your DB with is above board - it is a fairly trivial process to bypass JS validation and submit malicious / incorrect data.

The question is what are you using server side to process in the incoming data?
Use ASCII Character & for &. It should work.