I can't really see your mistake from the code, but anyway, here are
two things that could be wrong:

1. for client-side validation to work, you need to set the
clienValidationEnabled parameter of your form to true

2. be sure to bind the form's delegate-parameter to your delegate.

3. if you want server-side validation check the delegate bean using hasErrors

2007/8/16, ipoese <[EMAIL PROTECTED]>:
>
> Hi Everyone,
>
> i've been teaching myself tapestry for some time now, and everytime i think
> i am finally getting a grip on it something new comes up.
> OK, here's the deal... (i'll be using snippets since you guys probably don't
> want a million lines of code... all code i post compiles in it's context and
> runs without exceptions)
>
> i have to pages, Login and Register
>
> First for login:
>
> Login.html has:
> <tr>
>   <td><label jwcid="@FieldLabel" field="component:username">User
> Name</label></td>
>   <td><input jwcid="username"/></td>
> </tr>
>
> Login.page has:
>   <bean name="ValidString" class="myproject.Validator.ValidString" />
>
>   <component id="username" type="TextField">
>     <binding name="value" value="username"/>
>     <binding name="validators" value="validators:required,$ValidString" />
>     <binding name="displayName" value="message:username" />
>   </component>
>
> Login.java has:
>
>   public abstract String getUsername();
>   public abstract void setUsername(String Username);
>
>   public IPage tryLogin(){ // <-- gets called when the form around username
> is submitted
>     //do fancy stuff
>   }
>
> this works quite good. it checks the enteresd string in username against the
> self written Validator $ValidString. I can debug, breakpoint, step-though
> and see all the magic happening. quite cool, acctually.
>
> Now for Register
>
> Register.html
>   <tr><td>firstname </td><td><input type="text" jwcid="firstname"
> /></td></tr>
>   <tr><td>lastname  </td><td><input type="text" jwcid="lastname"
> /></td></tr>
>
> Register.page
>   <bean name="ValidString" class="myproject.Validator.ValidString" /> <!--
> same validator as before -->
>
>   <!-- Form -->
>   <component id="register" type="Form">
>     <binding name="listener" value="listener:tryUserCreate"/>
>   </component>
>
>   <component id="submitRegister" type="Submit">
>   </component>
>
>   <!-- Attributes of a Person -->
>   <component id="firstname" type="TextField">
>     <binding name="value" value="firstname"/>
>     <binding name="validators" value="validators:required,$ehfgbiasdbgujas"
> /> <!-- NOTE THIS -->
>   </component>
>
>   <component id="lastname" type="TextField">
>     <binding name="value" value="lastname"/>
>     <binding name="validators" value="validators:required,$ValidString" />
>   </component>
>
> Register.java
>
>   public abstract String getFirstname();
>   public abstract String getLastname();
>
>   public IPage tryUserCreate(){
>     // do more fancy stuff
>   }
>
> now this acctually compiles and runs (!!!) without an error or expection
> even tho the gibberish Validator bean in firstname does not exist. This form
> has a lot more fields to it, and two more self written validators but this
> is pretty much the essence.
> now - the Validators here get ignored. i can write anything after the $ and
> it still runs through without any trouble. I can even delete the bean
> statement completely withouth raising an exception.
> required is also ignored - it jumps right into the listener without looking
> at the Validators.
> This started happening after i had to refactor the class to move it to
> another package. Used the NetBeans refactor (which always worked before) and
> suddenly it would not validate anymore. Refactoring it back does not help
> either.
>
> if i type somthing like this in one if the TextFields it does give me an
> exception upon loading the page:
> <binding name="validators" value="validators:required,fsgdsfghkjsn" />
>
> Here is what i have tried:
>
> i have moved the Form around in register - even used it inline - same thing
> i have copied and pasted the content to a new file - same thing
> i have used tapestry 4.1.1, 4.1.2 and the nightly 4.1.3 - same thing
> i have deleted the project and reloaded it from svn - same thing
> i have set up NetBeans completely new - same thing
> i have run the application on two more machines (Windows, Debian, Ubuntu) -
> same thing
> i have run it with sun java 1.5 and 1.6 - same thing
>
> also, if i tried to use a Fieldlabel (maybe thats the error ?) and copied
> the username from Login to Register (it has a username too) - one to one
> copy - works in Login, not in Register (the Fieldlabel says no DisplayName
> was set in Username - which i definetly had set - and throws an expception)
>
> anybody got any idea why the validators get ignored or why Register is
> behaving to strange ? i really need this to work sometime soon...
>
> Hope this mail is not too cryptic,
> Ingmar
> --
> View this message in context: 
> http://www.nabble.com/-Tapestry-Beginner--Validation-is-ignored-tf4278261.html#a12177442
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Marcus Schulte
http://marcus-schulte.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to