473,715 Members | 5,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple Form Validation

I've been playing with this form validation method for a while and have
tried an array of things but haven't had any luck with a couple items.

1. The validateForm() function doesn't detect when the Min price is
greater than the maximum price.
2. The validateForm() function doesn't call isNumber() on the minBaths,
maxBaths, minBeds, or maxBeds.
3. Despite errors in input and the validateForm() function returning
false, the form is still submitted.

These are probably obvious fixes...I'm just not seeing them. thanks for
any help.

Here's the code:
<html>
<head>
<title></title>
<link rel="stylesheet " href="css/main.css">
<script language="JavaS cript">
<!--
function validateForm(th isForm){
alert("validate Form() called");
//alert("'" + thisForm.minBat hs.value + "'");
//alert(isNumber( thisForm.minBat hs.value));
if (thisForm.minPr ice.value == "") {
alert("You must enter a starting price.");
thisForm.minPri ce.focus();
return false;
} else if(!isNumber(th isForm.minPrice .value)) {
alert("Please enter a number for the starting price.");
thisForm.minPri ce.focus();
return false;
} else if (thisForm.maxPr ice.value == "") {
alert("You must enter a maximum price.");
thisForm.maxPri ce.focus();
return false;
} else if(!isNumber(th isForm.maxPrice .value)) {
alert("Please enter a number for the maximum price.");
thisFormForm.ma xPrice.focus();
return false;
} else if(thisForm.min Price.valueOf() >
thisForm.maxPri ce.valueOf()) {
alert("The starting value is greater than the maximum price.");
thisForm.minPri ce.focus();
return false;
} else if(!isNumber(th isForm.minBaths .value)) {
alert("Please enter a number for the minimum bathrooms.");
thisForm.minBat hs.focus();
return false;
} else if(!isNumber(th isForm.maxBaths .value)) {
alert("Please enter a number of the maximum bathrooms.");
thisForm.maxBat hs.focus();
} else if(!isNumber(th isForm.minBeds. value)) {
alert("Please enter a number for the minimum bedrooms.");
thisForm.minBed s.focus();
return false;
} else if(!isNumber(th isForm.maxBeds. value)) {
alert("Please enter a number for the maximum bedrooms.");
thisForm.maxBed s.focus();
return false;
} else {
return false;
}
}

function isNumber(entry) {
//alert("isNumber () Called");
validChar='0123 456789'; // characters allowed
strlen=entry.le ngth; // how long is test string
if (strlen < 1) {return false;} // no check!
// Now scan string for illegal characters
for (i=0; i < strlen; i++ ) {
if (validChar.inde xOf(entry.charA t(i)) < 0) {
return false;
}
}
//alert("returnin g true");
return true;
}

//-->
</script>
</head>
<body>
<!-- HEADER START -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" >
<tr>
<td class="bottombo rder" colspan="3">
<div align="right" style="font-size:12px;">| <a
href="/">Home</a> |
<a href="/about.php">Abou t</a> |
<a href="/contact.php">Co ntact</a> |&nbsp;</div>
</td>
</tr>
<!-- HEADER END -->
<tr>
<td valign="top" width="550">
<form name="searchFor m" onSubmit="retur n validateForm(th is)"
method="post">
<input type="hidden" name="advanced" value="true" />
<input type="hidden" name="valid" value="true" />
<table width="600" cellspacing="1" cellpadding="1" border="0"
class="padLeft" >
<tr>
<td nowrap align="right">S treet:</td>
<td colspan="7" nowrap>&nbsp;&n bsp;&nbsp;<inpu t
type="text" name="StreetNam e" size="30" value=""/></td>
</tr>
<tr>
<td nowrap align="right">C ity:</td>
<td nowrap colspan="4">&nb sp;&nbsp;&nbsp; <input
type="text" name="City" size="20"
value=""/>&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;&nbsp;State:
&nbsp;&nbsp;&nb sp;
<select name="State">
<option value="NC">NC</option>
<option value="SC">SC</option>
</select>
<span
style="padding-left:6px;paddin g-right:6px;font-size:12px;font-weight:bold;col or:$999";>-OR-</span>
Zip Code:&nbsp;&nbs p;&nbsp;<input type="text" name="ZipCode" size="6"
maxlength="5" value=""/></td>
</tr>
<tr>
<td colspan="5">&nb sp;</td>
</tr>
<td colspan="5" style="padding-left:10px">
<table border="0" cellpadding="1" cellspacing="1" >
<tr>
<td nowrap align="right">M in Price:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="minPrice" size="4" value="120000"/></td>
<td nowrap align="right">M ax Price:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="maxPrice" size="4" value="125000"/></td>
</tr>
<tr>
<td nowrap align="right">M in Beds:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="minBeds" size="4" maxlength="2" /></td>
<td nowrap align="right">M ax Beds:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="maxBeds" size="4" maxlength="2" /></td>
</tr>
<tr>
<td nowrap align="right">M in Baths:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="minBaths" size="4" maxlength="2" value="ax" /></td>
<td nowrap width="75" align="right">M ax Baths:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="maxBaths" size="4" maxlength="2" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><in put type="submit" value="Submit"
name="submit" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>

Oct 15 '05 #1
11 2528
On 15/10/2005 21:28, gr************* *@gmail.com wrote:

[snip]
<script language="JavaS cript">
The language attribute has long been deprecated in favour of the
required type attribute:

<script type="text/javascript">
<!--
Don't use SGML comment delimiters in SCRIPT elements.

[snip]
if (thisForm.minPr ice.value == "") {
Form controls shouldn't be thought of as properties of the FORM object.
FORM objects have a property, elements, that contain the controls as a
collection.

A simpler test for an empty string is to convert it to a boolean. Empty
strings type-convert to boolean false:

var controls = thisForm.elemen ts;

if(!controls.mi nPrice.value) {

[snip]
} else if(thisForm.min Price.valueOf() >
thisForm.maxPri ce.valueOf()) {
Depending which browser you run this in, it either won't do what you
want (compare the user input values as numbers), or it will error out.

IE does the latter, and this is most likely why the form submission
isn't stopped.

[snip]
} else {
return false;
}
The else clause should return true. Was this just for testing purposes?
function validateForm(fo rm) {
var controls = form.elements,
minPrice = controls.minPri ce,
maxPrice = controls.maxPri ce,
minBaths = controls.minBat hs,
maxBaths = controls.maxBat hs,
minBeds = controls.minBed s,
maxBeds = controls.maxBed s;

/* The isNumber function used here should be the second one
* proposed below. That regular expression ensures that at
* least one character is present, and that it's a number.
*/
if(!isNumber(mi nPrice.value)) {
alert('Please enter a number for the minimum price.');
minPrice.focus( );
return false;
}
if(!isNumber(ma xPrice.value)) {
alert('Please enter a number for the maximum price.');
maxPrice.focus( );
return false;
}
/* Notice below that the string values are type-converted
* to numbers before the comparison is made.
* We already know that the string represents a number.
*/
if(+minPrice.va lue > +maxPrice.value ) {
/* String literal wrapped for posting, only. */
alert('The starting value must not be '
+ 'greater than the maximum price.');
minPrice.focus( );
return false;
}
if(!isNumber(mi nBaths.value)) {
alert('Please enter a number for the '
+ 'minimum number of bathrooms.');
minBaths.focus( );
return false;
}
if(!isNumber(ma xBaths.value)) {
alert('Please enter a number for the '
+ 'maximum number of bathrooms.');
maxBaths.focus( );
return false;
}
if(!isNumber(mi nBeds.value)) {
alert('Please enter a number for the '
+ 'minimum number of bedrooms.');
minBeds.focus() ;
return false;
}
if(!isNumber(ma xBeds.value)) {
alert('Please enter a number for the '
+ 'maximum number of bedrooms.');
maxBeds.focus() ;
return false;
}
return true;
}
function isNumber(entry) {
//alert("isNumber () Called");
validChar='0123 456789'; // characters allowed
strlen=entry.le ngth; // how long is test string
if (strlen < 1) {return false;} // no check!
// Now scan string for illegal characters
for (i=0; i < strlen; i++ ) {
if (validChar.inde xOf(entry.charA t(i)) < 0) {
return false;
}
}
//alert("returnin g true");
return true;
}
A simpler, quicker test for numbers is to use regular expressions.

function isNumber(string ) {
return !/\D/.test(string);
}

This simply ensures that the string doesn't contain non-digit
characters, which is fine in most simple cases where only integers are
permitted as input. Something a little more complex would be:

function isNumber(string ) {
return /^(0|[1-9]\d*)(\.\d+)?$/.test(string);
}

which allows for decimal values, too.

[snip]
<div align="right" style="font-size:12px;">| <a
href="/">Home</a> |
<a href="/about.php">Abou t</a> |
<a href="/contact.php">Co ntact</a> |&nbsp;</div>
That should be marked-up as a list (UL) of links.

[snip]
<form name="searchFor m" onSubmit="retur n validateForm(th is)"
method="post">
I assume you omitted the action attribute just for this example?
<input type="hidden" name="advanced" value="true" />
You seem to be confused about whether you're writing HTML or XHTML. Just
use the former.

[snip]
<span style="padding-left:6px;paddin g-right:6px;font-size:12px;
Don't specify font sizes using pixels as this prevents IE from resizing
the text. Use percentages, instead (preferably no lower than 85% of
default).
font-weight: bold;color:$999 ";>-OR-</span>


Was the dollar symbol ($) intentional, or a typo for a hash (#)?

[snip]

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Oct 15 '05 #2
Nag
1. The validateForm() function doesn't detect when the Min price is
greater than the maximum price.
You should use 'value' method insted of valueOf().
2. The validateForm() function doesn't call isNumber() on the minBaths,

maxBaths, minBeds, or maxBeds.
There is some problem in your logic. Please find my changed logic
below. Also, you can make use of built in javascript function for
checking number or not by isNaN()
3. Despite errors in input and the validateForm() function returning
false, the form is still submitted.
Check the changed form below.

Pls test this form, let me know if you have any problem.

Thanks,
Nag.

---------------------------
Starts here
---------------------------

<html>
<head>
<title></title>
<link rel="stylesheet " href="css/main.css">
<script language="JavaS cript">
<!--
function validateForm(th isForm){
var okay = true;
alert("validate Form() called");
alert("Value of minprice" + thisForm.minPri ce.value);
if (thisForm.minPr ice.value == "") {
alert("You must enter a starting price.");
thisForm.minPri ce.focus();
okay = false;
} else if(isNaN(thisFo rm.minPrice.val ue)) {
alert("Please enter a number for the starting price.");
thisForm.minPri ce.focus();
okay = false;
}

if(okay)
{
alert("Inside maxPrice block:");
if (thisForm.maxPr ice.value == "") {
alert("You must enter a maximum price.");
thisForm.maxPri ce.focus();
okay = false;
} else if(isNaN(thisFo rm.maxPrice.val ue)) {
alert("Please enter a number for the maximum price.");
thisFormForm.ma xPrice.focus();
okay = false;
}
}

if(okay)
{
alert("in comparision block");
if(thisForm.min Price.value > thisForm.maxPri ce.value) {
alert("The starting value is greater than the maximum price.");
thisForm.minPri ce.focus();
okay = false;
}
else
okay = true;
}

if(okay)
{
if(isNaN(thisFo rm.minBaths.val ue)) {
alert("Please enter a number for the minimum bathrooms.");
thisForm.minBat hs.focus();
okay = false;
} else if(isNaN(thisFo rm.maxBaths.val ue)) {
alert("Please enter a number of the maximum bathrooms.");
okay = false;
} else if(isNaN(thisFo rm.minBeds.valu e)) {
alert("Please enter a number for the minimum bedrooms.");
thisForm.minBed s.focus();
okay = false;
} else if(isNaN(thisFo rm.maxBeds.valu e)) {
alert("Please enter a number for the maximum bedrooms.");
thisForm.maxBed s.focus();
okay = false;
} else {
okay = true;
}
}

if(okay)
return true;
else
return false;
}
//-->
</script>
</head>
<body>
<!-- HEADER START -->
<table border="0" width="100%" cellpadding="0" cellspacing="0" >
<tr>
<td class="bottombo rder" colspan="3">
<div align="right" style="font-size:12px;">| <a
href="/">Home</a> |
<a href="/about.php">Abou t</a> |
<a href="/contact.php">Co ntact</a> |&nbsp;</div>
</td>
</tr>
<!-- HEADER END -->
<tr>
<td valign="top" width="550">
<form name="searchFor m" onSubmit="retur n validateForm(th is)"
method="post">
<input type="hidden" name="advanced" value="true" />
<input type="hidden" name="valid" value="true" />
<table width="600" cellspacing="1" cellpadding="1" border="0"

class="padLeft" >
<tr>
<td nowrap align="right">S treet:</td>
<td colspan="7" nowrap>&nbsp;&n bsp;&nbsp;<inpu t
type="text" name="StreetNam e" size="30" value=""/></td>
</tr>
<tr>
<td nowrap align="right">C ity:</td>
<td nowrap colspan="4">&nb sp;&nbsp;&nbsp; <input
type="text" name="City" size="20"
value=""/>&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;&nbsp;State:
&nbsp;&nbsp;&nb sp;
<select name="State">
<option value="NC">NC</option>
<option value="SC">SC</option>
</select>
<span
style="padding-left:6px;paddin g-right:6px;font-size:12px;font-weight:bold;c*o lor:$999";>-OR-</span>

Zip Code:&nbsp;&nbs p;&nbsp;<input type="text" name="ZipCode" size="6"
maxlength="5" value=""/></td>
</tr>
<tr>
<td colspan="5">&nb sp;</td>
</tr>
<td colspan="5" style="padding-left:10px">
<table border="0" cellpadding="1" cellspacing="1" >
<tr>
<td nowrap align="right">M in Price:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="minPrice" size="4" value="120000"/></td>
<td nowrap align="right">M ax Price:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="maxPrice" size="4" value="125000"/></td>
</tr>
<tr>
<td nowrap align="right">M in Beds:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="minBeds" size="4" maxlength="2" /></td>
<td nowrap align="right">M ax Beds:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="maxBeds" size="4" maxlength="2" /></td>
</tr>
<tr>
<td nowrap align="right">M in Baths:</td>
<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="minBaths" size="4" maxlength="2" value="ax" /></td>
<td nowrap width="75" align="right">M ax Baths:</td>

<td nowrap>&nbsp;&n bsp;&nbsp;<inpu t type="text"
name="maxBaths" size="4" maxlength="2" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><in put type="submit" value="Submit"
name="submit" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>

-----------------
ends here
-----------------

Oct 15 '05 #3
Michael Winter wrote:
[...]
/* Notice below that the string values are type-converted
* to numbers before the comparison is made.
* We already know that the string represents a number.
*/
if(+minPrice.va lue > +maxPrice.value ) {


A question Mike:

You are using the unary '+' to convert the strings to numbers, but when
strings are used in a numeric comparison they are converted to numbers
automatically. Therefore the use of '+' seems to be redundant.

Is there some other reason for it?

[...]

--
Rob
Oct 16 '05 #4
RobG wrote:
Michael Winter wrote:
[...]
/* Notice below that the string values are type-converted
* to numbers before the comparison is made.
* We already know that the string represents a number.
*/
if(+minPrice.va lue > +maxPrice.value ) {


A question Mike:

You are using the unary '+' to convert the strings to numbers,
but when strings are used in a numeric comparison they are
converted to numbers automatically.

<snip>

Not true. The Abstract Relational Comparison Algorithm (ECMA 262 3rd
edition; section 11.8.5) has a strong preference for doing its
comparisons with numeric value but set 3 tests to see if both operands
are strings and if they are it jumps to step 16, where the strings are
subject to comparison as a sequence of characters.

As form the control's - value - properties are of string type, comparing
two of them will require the explicit type-conversion if numeric
comparison is required, (Though it would only be strictly necessary to
explicitly type-convert one of the operands to avoid step 3 jumping to
step 16.)

Richard.
Oct 16 '05 #5
Richard Cornford wrote:
RobG wrote:
Michael Winter wrote:
[...]
/* Notice below that the string values are type-converted
* to numbers before the comparison is made.
* We already know that the string represents a number.
*/
if(+minPrice.va lue > +maxPrice.value ) {


A question Mike:

You are using the unary '+' to convert the strings to numbers,
but when strings are used in a numeric comparison they are
converted to numbers automatically.


<snip>

Not true. The Abstract Relational Comparison Algorithm (ECMA 262 3rd
edition; section 11.8.5) has a strong preference for doing its
comparisons with numeric value but set 3 tests to see if both operands
are strings and if they are it jumps to step 16, where the strings are
subject to comparison as a sequence of characters.

As form the control's - value - properties are of string type, comparing
two of them will require the explicit type-conversion if numeric
comparison is required, (Though it would only be strictly necessary to
explicitly type-convert one of the operands to avoid step 3 jumping to
step 16.)


Thanks Richard, it was clearly a misunderstandin g on my part.

I realise now that it came from comparing values to numbers
(e.g. minPrice.value > 0) where the 'jump to step 16' is prevented.

--
Rob
Oct 16 '05 #6
Mike

Thanks for such a thorough response. I've updated my validateForm()
method and it works great. one question I had on your comments however
is related to the links:
<div align="right" style="font-size:12px;">| <a
href="/">Home</a> |
<a href="/about.php">Abou t</a> |
<a href="/contact.php">Co ntact</a> |&nbsp;</div>

That should be marked-up as a list (UL) of links.


Can you give me an example of what you mean with the <ul> tag and the
links ?

Thanks, Greg

Oct 16 '05 #7
JRS: In article <11************ ********@g47g20 00cwa.googlegro ups.com>,
dated Sat, 15 Oct 2005 13:28:18, seen in news:comp.lang. javascript,
gr************* *@gmail.com posted :
I've been playing with this form validation method for a while and have
tried an array of things but haven't had any luck with a couple items.
Don't rely on luck. If something does not work, isolate it as a minimal
test case, reducing it until you understand. Also, read the newsgroup
FAQ.

You've used .value in some places and .valueOf() in others.
Strings are compared as strings, and can be converted to numbers with
unary +.
You don't need else after if () { ... return } .
Repetitive code should be replaced with function calls.
Untested Example :

function Empty(Item, Name) {
var Bad = Item.value > ""
if (Bad) { alert("You must enter a " + Name) ; Item.focus() }
return Bad

....

if (Empty(thisForm .minPrice, "starting price.")) return false
if (Empty(thisForm .maxPrice, "maximum price.")) return false
function isNumber(entry) { return /^\d+$/.test(entry) }
if (strlen < 1) {return false;} // no check! // no need.
<div align="right" style="font-size:12px;">| <a
Specifying absolute sizes is in breach of disabled access legislation
principles in civilised countries. Likewise absolute widths.

<form name="searchFor m" onSubmit="retur n validateForm(th is)"
method="post ">


Don't let your posting agent wrap lines, whether HTML or script. The
experts prefer not to waste time with unnecessary errors.

Read the newsgroup FAQ again. And read <URL:http://www.merlyn.demon.co.
uk/js-valid.htm>.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 16 '05 #8
JRS: In article <11************ **********@g44g 2000cwa.googleg roups.com>
, dated Sat, 15 Oct 2005 16:29:46, seen in news:comp.lang. javascript,
Nag <Na************ @gmail.com> posted :

if(okay)
return true;
else
return false;

You mean
return okay

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 16 '05 #9
Greg Scharlemann wrote:
Mike

Thanks for such a thorough response. I've updated my validateForm()
method and it works great. one question I had on your comments however
is related to the links:

<div align="right" style="font-size:12px;">| <a
href="/">Home</a> |
<a href="/about.php">Abou t</a> |
<a href="/contact.php">Co ntact</a> |&nbsp;</div>

That should be marked-up as a list (UL) of links.

Can you give me an example of what you mean with the <ul> tag and the
links ?


Search for "css horizontal list", below is an example but for a fairly
thorough treatment:

<URL:http://www.alistapart. com/articles/taminglists/>

<head>
<style type="text/css">
#navLinks li {
display: inline;
list-style-type: none;
padding: 0 5px 0 0;
}
</style>
<body>
<ul id="navLinks">
<li><a href="/about.php">Abou t</a></li>
<li><a href="/contact.php">Co ntact</a></li>
</ul>

--
Rob
Oct 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
8289
by: Phil Powell | last post by:
Where can I find an online PHP form validator script library to use? I have tried hacking the one here at work for weeks now and it's getting more and more impossible to customize, especially now with form elements that turn out to be arrays that have to be compared with one another! I have one form element, languages, a checkbox group. Beside each checkbox is a dropdown, proficiency (which will become proficiency alongside languages)....
4
9977
by: TG | last post by:
I have a validation form that must behave differently based on the results of a PHP validation check. I have a post command at the top of my form that calls itself. I don't leave the form when performing the validation check on the values that were entered into the form, I simply repost the form to perform the PHP validation. If any of the values that have been entered into the form are incorrect, I display a warning message on the screen...
7
2976
by: r0adhog | last post by:
I have a very simple form: <html> <head> </head> <body> <% function ValForm() if len(document.form.newapp.all("AccessCode").Value) = 4 then document.form.newapp.submit()
3
1644
by: Marc Llenas | last post by:
Hi there, I'm stuck on a validation function for a form and I cannot figure out what the problem is. The page is in ASP. Any ideas? The function being called is: <script language="JavaScript" type="text/javascript"> function checkform ( form ) {
16
2244
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate individual fields, such as an "Email Validation Script" or a "Phone Validation Script". Is it ok to put all these scripts on page as they are or should they be joined in some way together to be one script? I'm a total JavaScript newbie and am completely...
2
8399
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
18
3037
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How ??
9
4177
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be honest I usually hire someone to do it for me, grab predone scripts and kind of hack out the parts that I need, or just do very minimal validation (e.g. this is numeric, this is alpha-numeric, etc.)
27
4749
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
11
2997
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether certain fields match certain criteria, and inform the user in different ways when the data is wrong (offcourse, this will be checked on posting the data again, but that's something I've got a lot of experience with). Now, offcourse it's...
0
8823
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8718
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9343
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9047
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5967
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.