Re: Form Validation
"Ming Peng" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,Diez You can see the code in "LoginScreen.java" of the DiscRack sample.If I click the "Submit" without filling the "username" field which has the NotNullValidator,will the "LoginValidator" execute?If "yes",will I get the Exceptione for the "null" problem?If I comment out the code--- if (user != null && password != null)---It seems a NullPointException will be thrown.But this special code is for the validation for "Null input" and a validator for forbiding "blank input" has been defined.Is that redundant? >From: "Diez B. Roggisch" <[email protected]> >Reply-To: [email protected] >To: [email protected] >Subject: Re: [Barracuda] Form Validation >Date: Tue, 1 Jul 2003 22:13:51 +0200 > >Hi, > > > I just have a question about the process of "Form Validation".If I have > > the following code--- ---this.defineElement( new > > DefaultFormElement(lOG_NAME,FormType.STRING,null,new > > NotNullValidator("Login Name error"),false) ); > > > > And I also define a form validator later.When I call > > "form.map().validate(true)" and I didn't fill the "login" field,will the > > validation process stop here? If not,and the ValidationException is also > > thrown in my form validator,will I catch the exception from the > > "NotNullValidator"? > >As you wrote yourself: By passing true to validate, the exceptions that occur >in single validators are deferred, so you end up with one exception >containing all exceptions thrown in your formvalidators. Or, to put it >differetn: the validation of subsequent formelements won't stop after one >validator fails. > >Diez > >_______________________________________________ >Barracuda mailing list >[email protected] >http://barracudamvc.org/lists/listinfo/barracuda _________________________________________________________________ 涓虹杩琛浜ゆ锛璇蜂娇 MSN Messenger: http://messenger.msn.com/cn