473,763 Members | 7,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form validation question

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 lost.

Thanks for reading!
Oct 22 '05
16 2250
Hosh wrote:
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 lost.

Thanks for reading!

First, Javascript form data validation is a misused term. You can make
sure submitted data is valid by utilizing client side technologies (i.e.
JavaScript). They can be fooled, disabled, bypassed, etc. Data
validation should be the job of the server side script.
Client side is useful in helping users fill the form, saving their time
and server bandwidth by pointing out errors and omissions. When both are
implemented properly, some functionality may overlap, but it will not be
all the same.

That said, google "fValidate"

--
Vladdy
http://www.klproductions.com
Oct 23 '05 #11

"Vladdy" <vl**@klproduct ions.com> wrote in message
news:SXC6f.2432 $c4.1437@trndny 03...
Hosh wrote:
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 lost.

Thanks for reading!

First, Javascript form data validation is a misused term. You can make
sure submitted data is valid by utilizing client side technologies (i.e.
JavaScript). They can be fooled, disabled, bypassed, etc. Data validation
should be the job of the server side script.
Client side is useful in helping users fill the form, saving their time
and server bandwidth by pointing out errors and omissions. When both are
implemented properly, some functionality may overlap, but it will not be
all the same.

That said, google "fValidate"

--
Vladdy
http://www.klproductions.com


Thanks.
I am aware of the potential problems with client-side validation, including
the fact that 10% of users have Javascript turned off in their browsers.
I do in fact have server-side data validation going on. I just wanted to
have some Javascript validation for exactly the reasons that you've outlined
above. The form I have is large and was hoping to alert the user to errors
as they went along as opposed to when they clicked the submit button.
Thanks again.
Oct 23 '05 #12
Hosh wrote:
[...]
I am aware of the potential problems with client-side validation,
including the fact that 10% of users have Javascript turned off in their
browsers.


Your numbers are -- as always with so-called statistics,
without reliable representative data to base on -- wrong.

And please learn how to quote properly: <http://jibbering.com/faq/>
PointedEars
Oct 23 '05 #13
Thomas 'PointedEars' Lahn said the following on 10/23/2005 4:50 AM:
Hosh wrote:

[...]
I am aware of the potential problems with client-side validation,
including the fact that 10% of users have Javascript turned off in their
browsers.

Your numbers are -- as always with so-called statistics,
without reliable representative data to base on -- wrong.


Do you have firsthand knowledge that he *doesnt* have "reliable
representative data" to base that 10% on? Unless you do, you can in *no
way* say it is wrong.
And please learn how to quote properly: <http://jibbering.com/faq/>


There was nothing wrong with the way Hosh quoted short of his news agent
not trimming the signature. But the quoting itself was fine.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Oct 23 '05 #14
"Hosh" <1@2.com> writes:
The form I have is large and was hoping to alert the user to errors
as they went along as opposed to when they clicked the submit button.


In that case, what you want is not really "form validation" as much
as "field validation", since you validate each data field for itself.

It's more likely that you can combine several individual field
validation scripts on a page without changing them (as long as there
is no name collision) than that you could do the same for form
validations, since they are run independently.

A template for a single field validation would be something like:

---
<script type="text/javascript">
function validateSomePro perty(field) {
var value = field.value;
if (!... some test on value...) {
// report error, e.g.,
field.style.bor derColor = "red";
// or : alert("Field foo contains invalid character"), or ...

// possibly fix entry (e.g., date into consisten format)
}
}
</script>
...
<form ...>
... <input type="text" name="email"
onchange="valid ateSomeProperty (this)"> ...
</form>
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Oct 23 '05 #15
JRS: In article <SXC6f.2432$c4. 1437@trndny03>, dated Sun, 23 Oct 2005
02:54:42, seen in news:comp.lang. javascript, Vladdy
<vl**@klproduct ions.com> posted :
First, Javascript form data validation is a misused term. You can make
sure submitted data is valid by utilizing client side technologies (i.e.
JavaScript). They can be fooled, disabled, bypassed, etc. Data
validation should be the job of the server side script.
Client side is useful in helping users fill the form, saving their time
and server bandwidth by pointing out errors and omissions. When both are
implemented properly, some functionality may overlap, but it will not be
all the same.

Don't presume that all processing is always carried out on the server,
or that any data is necessarily returned to the server. Javascript has
applications other than commercial.

--
© 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 23 '05 #16
Dr John Stockton wrote on 23 okt 2005 in comp.lang.javas cript:
JRS: In article <SXC6f.2432$c4. 1437@trndny03>, dated Sun, 23 Oct 2005
02:54:42, seen in news:comp.lang. javascript, Vladdy
<vl**@klproduct ions.com> posted :
First, Javascript form data validation is a misused term. You can make
sure submitted data is valid by utilizing client side technologies (i.e.
JavaScript). They can be fooled, disabled, bypassed, etc. Data
validation should be the job of the server side script.
Client side is useful in helping users fill the form, saving their time
and server bandwidth by pointing out errors and omissions. When both are
implemented properly, some functionality may overlap, but it will not be
all the same.

Don't presume that all processing is always carried out on the server,
or that any data is necessarily returned to the server. Javascript has
applications other than commercial.


True.

If I want to do maintenance on my own on server databases from clientside
with a well password [and IP tested] protected page, clientside string
input validation is just as safe [and much faster].

"Hacking you own site" is a contradictio in terminis.
JRS: In article <SXC6f.2432$c4. 1437@trndny03>, dated Sun, 23 Oct 2005
client side technologies (i.e. JavaScript).


Only partly. I use serverside javascript too.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 24 '05 #17

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

Similar topics

11
8756
by: Jim | last post by:
Hi, I keep getting form results emailed to me that would indicate a form from my web site is getting submitted with all fields blank or empty, but my code should preventing users from proceeding if they left any field blank. My guess is that someone is trying to hack the site using the form to gain entry or run commands -- I don't really know since I'm not a hacker. I just know that forms are often susceptible to these kinds of...
6
4341
by: Charles Banas | last post by:
weird subject - i hope more than just one curious regular will hear me out. :) ok, i've got a bit of a big problem, and i need answers as soon as possible. i know this forum is meant for web developers, but is relevant discussion. i'm not OT here unless someone thinks i'm trolling (which i'm not, obviously). then i'll disappear and never show my face again. :P
6
1936
by: Drew | last post by:
I've already created a simple method of ensuring that all form feilds are filled out before the form is submitted to an ASP page for records to be added to the data base. (Sorry about the formating, my newsreader may make it a mess!) <script language="javascript"> <!-- function Check(form) {
2
2367
by: Tim Mills | last post by:
The following code asks the user to sumbit a name, email address, and some text for a quotation via a FORM. I have written a javascript function to evaluate the fields in the form and pop-up a message to tell the user if all the fields have been fill-out. If the user has missed some information the form re-displays with red "alerts" indicating where the user have missed the information while re-populating the information the user has...
1
1631
by: Colin Basterfield | last post by:
Hi, I have a web form which takes daily sales totals, both counts and monetary value and is done on a weekly basis, so on a Monday morning the User would enter these totals. Each total has a range, which at the lower end is >= 0 and the upper limit is configurable, these totals are then submitted to a web service which posts them to a data store. The question is regarding validation, obviously I can validate on the web form using...
9
4180
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
4753
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
3000
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...
18
5808
by: Axel Dahmen | last post by:
Hi, trying to submit an ASPX form using the key (using IE6) the page is not submitted in my web project. Trying to debug the pages' JavaScript code I noticed that there's some ASP.NET client script code being executed having a flaw: function anonymous() { if (!ValidatedTextBoxOnKeyPress(event)) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); return false; } }
0
9387
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
10148
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
9823
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
8822
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...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
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
5270
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...
1
3917
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
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.