Filip, validation would still fail then because passwordfield blanks the output value, i.e. the textfield is empty upon form submission. That's okay for creating new instances but not when editing existing ones where the field already contains data. The only solution I see is to do the validation myself and only update the password field value if the user entered something into the password field (i.e. it's non-blank).
I should have searched the archives before posting because here http://markmail.org/message/37zesradgyelevok Dan proposes this functionality to be built into the passwordfield component. Howard, would it be possible to make passwordfield smart enough to just update its value (and validate) if the user entered something non-blank and it had a value before, otherwise use the old value? Cheers, Uli Am Di, 2.09.2008, 16:31, schrieb Filip S. Adamsen: > Hi Ulrich, > > Just guessing here, but how about setting t:validate="minlength=1" on > the field? This will pass if the field is empty, afaik. Of course, you > can set it to the real minimum length of the password and add a > maxlength as well. > > That should do the trick. > > -Filip > > On 2008-09-02 16:17, Ulrich Stärk wrote: >> Hi all, >> >> I want to create and edit entities which have a required password field >> using the beaneditor component. In order to have the password obscured >> while being typed in (later it gets encrypted and stored in a database) >> I >> overrode the corresponding field whith >> >> <t:beaneditform t:id="form" t:object="account"> >> <t:parameter name="password"> >> <t:label for="password" /> >> <t:passwordfield t:id="password" value="account.password" /> >> </t:parameter> >> </t:beaneditform> >> >> My entity class has a @Validate("required") annotation applied to the >> getter of the password field. This all works well when I create a new >> instance of this entity type. But when I want to edit the entity, >> whithout >> modifying the password fields, this fails because the output value of a >> passwordfield is always blank per definition and thus validation fails. >> I >> am forced to re-enter some password even if I don't want to change it. >> How >> would you solve this? >> >> Cheers, >> >> Uli >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]