You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Anders Vesterberg <an...@vesdakon.se> on 2003/05/02 15:23:27 UTC

Retaining values in fields when validation errors (2)

*This message was transferred with a trial version of CommuniGate(tm) Pro*
Now I see that value is left out only for fields that are disabled:
<component id="kod" type="ValidField">
        <binding name="disabled" expression='pkReadonly'/>
        <static-binding name="displayName">Kod</static-binding>
        <binding name="validator" expression='beans.stringValidator'/>
        <binding name="value" expression='attributes.kod'/>
    </component>
I get a javascript error:
'Can't move the focus to the control because it is invisible, not enabled'
The value disappears when I enter an invalid value in some other field.

I am using Tapestry 2.3 on jdk 1.4.1_01 and Jetty 4.2.9.

/Anders Vesterberg
Vesdakon AB

Anders Vesterberg wrote:

> Hello
> I am working on a small example trying to imitate the vlib demo. I 
> have disabled client-side scripting. When I type something invalid in 
> a field I get a validationError in the same page as I should, but the 
> content of other fields are lost. The page is detached and my 
> attributes (Map) are lost. What is the best way to retain the values 
> in already entered fields when validation strikes?
>
> My formSubmit looks like this:
>    public void formSubmit(IRequestCycle cycle) throws 
> RequestCycleException {
>        // Submission has been performed. Validate the fields
>        ValidationDelegate delegate = (ValidationDelegate) 
> getBeans().getBean("delegate");
>        if (delegate.getHasErrors()) {
>            // there are errors
>            return;
>        }
>        // Update db      }
>
> Thanks!
> /Anders Vesterberg
> Vesdakon AB
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>