Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17899
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Mon, 31 Dec 2012 17:07:17 -0600 |
| From | Mike Filbin <michael.filbin@gmail.com> |
| Newsgroups | comp.lang.javascript |
| Date | Mon, 31 Dec 2012 16:07:18 -0700 |
| Message-ID | <2012123116071843163-michaelfilbin@gmailcom> (permalink) |
| References | <be8abd23-af86-48c7-be3f-a751ce6e574f@googlegroups.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Subject | Re: Question on form validation |
| User-Agent | Unison/2.1.10 |
| Lines | 37 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-JMTDDA4clQBvAhXfC/DMaZJCSTM6BLw6SaC1Wn1nblSXd+0kCyzY+kCEp4RG9L0nLlSOOBA3d8K3urD!RnIsZPOqPbGKgl7UDKCWBJx9IHWgJiyLyxLjUY05MHyeB75xvCZCdIoWJiQR2fzJrUsSE/JBzA== |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2096 |
| Xref | csiph.com comp.lang.javascript:17899 |
Show key headers only | View raw
Can you move your validation server-side? If your form is rendered
statically, the user can disable JavaScript to bypass your validation
script. Also, just a quick tip. Cache your reference to
'Form1.FieldName'. It is generally bad practice to resolve the same DOM
node twice. You can cache it like so:
var field = Form1.FieldName;
And then refer to it as
// Use triple equal for type corherced comparisons. Double euqals can
give unexpected results
if (field.value === ""){
…
field.focus();
...
} else {
...
}
On 2012-12-19 14:57:35 +0000, bravesplace@gmail.com said:
> I use the following to determine if a field is blank and to alert them
> the field is required:
>
> if (Form1.FieldName.value == "")
> {
> alert("Please enter a value for the FIELDNAME field.");
> Form1.FieldName.focus();
> return (false);
> }
>
> How can I use a LIKE type of statement so if they use a word we cannot
> allow such as "Stupid", I can advise them the word is not permitted?
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question on form validation bravesplace@gmail.com - 2012-12-19 06:57 -0800
Re: Question on form validation Stefan Weiss <krewecherl@gmail.com> - 2012-12-19 16:20 +0100
Re: Question on form validation Danny <dann90038@gmail.com> - 2012-12-19 13:38 -0800
Re: Question on form validation Mike Filbin <michael.filbin@gmail.com> - 2012-12-31 16:07 -0700
Re: Question on form validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-01 01:58 +0100
Re: Question on form validation "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-01 11:35 +0100
csiph-web