codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Javascript validation that will stop a ` (apostrophe) being entered  crmpicco at 17:21 on Tuesday, March 01, 2005
 

I'm looking for Javascript validation that will stop a ' (apostrophe) being entered into a HTML textbox form field.

Anyone have this?

Thanks

Picco

  Re: Javascript validation that will stop a ` (apostrophe) being entered  sels at 12:46 on Thursday, March 24, 2005
 

Hai

Please try the following code.

Here if u try to enter Apostrophe in the text box it will be remove the Apostrophe form the textbox.
is this ok for u.
if not revert mw u'r requirement.

=========================================================


<script language="JavaScript">
function checkApostrophe()
{
var tmp=document.forms[0].textboxName1.value;
if(tmp.match("'"))
{
var ne=tmp.replace("'","");
document.forms[0].textboxName1.value=ne;
}
}
</script>

<form name="formName1">
<br>
<table border="0" width="248" id="table1">
<tr>
<td width="27">
<input type="textbox" name="textboxName1" value="" size="15" onkeypress="checkApostrophe()"><br>

</tr>
</table>
<p> </p>
<p><br>
</p>
</form>

<p>


=========================================================

Thanks








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Searching a string
•  Need Code
•  ASP Sendmail has huge delay
•  help
•  help
•  How to lock SDBM file when that file is writing by multiple programs at the same time
•  How to host C++ Web Service in Apache
•  Re: dynamic crystal report generation
•  XML Parsing Error


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008