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
mrslate1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
You can use the 'replace' method in javascript http://www.w3schools.com/js/js_string_methods.asp but you will have to loop thru the fields when you submit the form.  It might be easier to do on the server in your server programming language when the data is received.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
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?
krishna kishore mellacheruvu venkataCommented:
Use ASCII Character & for &. It should work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.