Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with quotation mark in input field 1

Status
Not open for further replies.

Albano

Instructor
Dec 11, 2000
221
0
0
PT
Hello,

I have an input field, and when I enter a string with quotation (eg: xpto "hhh"), and submit the data the text in the quotation disapears, becoming (xpto ).

thanks,

Albano
 
If you could give an example of the code your using, it would be handy.

Have you tried using 'hhh'
 
The problem is that I can´t control the users from entering the quotation mark, so I need to replace the quotation mark before a submit is made.

Albano
 
o, just use a regular expression. like so..:
Code:
<html>
<head>
<script language='javascript'><!--
function wookie()
{
dastring = document.form1.input1.value;
daregexp = /\&quot;/gi; //creates the pattern to look for(quotes)
dastring = dastring.replace(daregexp,&quot;'&quot;); //searches the string for quotes, replaces them with single quptes if found
document.form1.input1.value = dastring; //replaces 1st value with the new one
document.form1.submit(); //submits the form, if u wanna do that
}
//--></script>
</head>
<body>
<form name='form1'>
<input type=text name='input1'>
<input type=button value=submit onClick='wookie()'>
</form>
</body>
</html>

hope this helps, if u have any questions jus post em here &quot;Those who dare to fail miserably can achieve greatly.&quot; - Robert F. Kennedy
So true..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top