| | |
Setting text field to accept only alphabetical characters.
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2008
Posts: 2
Reputation:
Solved Threads: 0
Hello all.
I am unable to solve two problems creating a contacts form using dreamweaver CS3. My other problem is posted under the heading, "Modify code created with Dreamweaver CS3, to compare two text feilds".
For this posting, can someone please tell me how to modify my code, pasted below, so that
the "First Name" and "Last Name" text fields are restricted to accepting only alphabetical characters.
Thank you
Here's my current code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" method="post" action="">
<p>First Name
<span id="sprytextfield1">
<input type="text" name="First_Name" id="First_Name" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p>Last Name
<span id="sprytextfield2">
<input type="text" name="First_Name2" id="First_Name2" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p> </p>
<p>Contact Tel
<span id="sprytextfield3">
<input type="text" name="Contact_Tel" id="Contact_Tel" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Please enter numerical characters only.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p>Confirm Contact Tel<span id="sprytextfield4">
<input type="text" name="Confirm_Contact_Tel" id="Confirm_Contact_Tel" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Please enter numerical characters only.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p> </p>
<p>
<input type="submit" name="Submit_button" id="Submit_button" value="Submit" />
</p>
</form>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {minChars:2, maxChars:15});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:2, maxChars:15});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "integer", {minChars:5, maxChars:15});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "integer", {minChars:5, maxChars:15});
//-->
</script>
</body>
</html>
I am unable to solve two problems creating a contacts form using dreamweaver CS3. My other problem is posted under the heading, "Modify code created with Dreamweaver CS3, to compare two text feilds".
For this posting, can someone please tell me how to modify my code, pasted below, so that
the "First Name" and "Last Name" text fields are restricted to accepting only alphabetical characters.
Thank you
Here's my current code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" method="post" action="">
<p>First Name
<span id="sprytextfield1">
<input type="text" name="First_Name" id="First_Name" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p>Last Name
<span id="sprytextfield2">
<input type="text" name="First_Name2" id="First_Name2" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p> </p>
<p>Contact Tel
<span id="sprytextfield3">
<input type="text" name="Contact_Tel" id="Contact_Tel" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Please enter numerical characters only.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p>Confirm Contact Tel<span id="sprytextfield4">
<input type="text" name="Confirm_Contact_Tel" id="Confirm_Contact_Tel" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Please enter numerical characters only.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></p>
<p> </p>
<p>
<input type="submit" name="Submit_button" id="Submit_button" value="Submit" />
</p>
</form>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {minChars:2, maxChars:15});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:2, maxChars:15});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "integer", {minChars:5, maxChars:15});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "integer", {minChars:5, maxChars:15});
//-->
</script>
</body>
</html>
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: select/save selected records
- Next Thread: Table Cell Population
Views: 3496 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp ajaxjspservlets animate api automatically blackjack browser bug calendar captchaformproblem checkbox child class close cookies createrange() cursor dependent disablefirebug dom dropdown editor element engine events explorer ext file firehose flash form forms game google gxt hiddenvalue highlightedword html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump libcurl margin math matrixcaptcha media microsoft mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post progressbar rated regex runtime scroll search security session shopping size software solutions sql star stars stretch synchronous text textarea twitter unicode validation web website window windowsxp wysiwyg xspf \n





