Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Field Validation using JavaScript
Message
De
13/08/2001 21:42:13
 
 
À
13/08/2001 20:35:56
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00543304
Message ID:
00543321
Vues:
14
>Hi All,
>
> I've come across a problem with validating fields in Javascript. I have a Dropdown on a webpage which allows the user to select a State for an address. If the State is left blank then an alert notifies the user to enter the state and the page is not submitted. It works fine in IE but in Netscape 4.7 & 6.0 if the state is empty the page is still submitted. If have similar validation on text fields and these work fine in Netscape, it's just dropdowns I'm having a problem with. Any ideas?
>
>
>if (mywebpage.State.value == "")
>{
>    alert("Please enter a State.");
>    mywebpage.State.focus();
>    return (false);
>}
>
>
>I've come across a number of quirks with the way javascript works ( or doesn't work ) in different browsers. I'm thinking of doing my validation on the server instead of the browser due to the fact that with client side validation you have to account for the different versions of browser. Which option is the safest, client side or server side validation?
>
>Thanks,
>Gavin...

Server side is safest, under these terms, because it's 100% controllable by you, since you're writing the objects and control the environment, language(s) and interpreters being used.
But the only reason I'd ever recommend server side validation for required fields like this is if you need to support multiple languages. It's easier if it's server side and data driven.

Client side validation is definitely faster, though, since there is less traffic - you never submit a page without required info (or more validation, if possible) and that required field logic stays on the client and off the server.

Doesn't
if (!mywebpage.State.value)
work on either IE or NS? I'd try that before moving it to the server.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform