I’ll start by saying I know virtually nothing about Javascript, beyond a broad idea of where it goes and what it does.
I have a small problem in terms of getting a form submitted to my action page (which, if relevant, is programmed in Coldfusion). The text field may contain certain characters that I need to replace before they hit the action page. For example, the user may enter something like ‘Save £5.00’. I therefore need to change the ‘£’ to ‘£’ - but I need to do this before the form is submitted.
My gut feeling is this is a job for Javascript - can anyone enlighten me please?
Thanks, but as mentioned it needs to be done client-side and before it hits the action page. I can do a replace with Coldfusion, but something strange is happening with the way the character is being transmitted between the form and the action page - hence the need to change it client-side.
Then you should look into that, instead of validating data client-side a visitor or user can enter. This could be a potential security risk if this situation occurs with other characters like quotes.
Thanks f0kin, I appreciate that server-side is a better method, but in this instance the form isn’t public anyway, so a hack isn’t as much of an issue (and I’ve already spent several days trying to figure out what’s going wrong).
I’ve tried the code you give, however I’m struggling to get it to work. Not getting any error messages or anything else, but I suspect my extremely limited JS knowledge is the problem. This is what I have at the moment;
I don’t think it is about FF or Mac. £ - is a char not from standard ascii table.
Ensure that you have UTF-8 encoding, and everything must work fine (I’ve checked :)).