Actually, that should work. As long as your components are visible in
the hierarchy. And they probably are, it's just the panels you have to
set visible.

The interesting thing is that I think we have a bug in the 1.2
implementation of FormComponent.

Compare this, correct visit of form components:

        protected final void updateFormComponentModels()
        {
                visitFormComponents(new FormComponent.IVisitor()
                {
                        public void formComponent(final FormComponent 
formComponent)
                        {
                                // Only update the component when it is visible 
and valid
                                if (formComponent.isVisibleInHierarchy() && 
formComponent.isEnabled()
                                                && formComponent.isValid() && 
formComponent.isEnableAllowed())
                                {
                                        // Potentially update the model
                                        formComponent.updateModel();
                                }
                        }
                });
        }

with this, I think incorrect visit:

        private void validateRequired()
        {
                visitFormComponents(new ValidationVisitor()
                {
                        public void validate(final FormComponent formComponent)
                        {
                                formComponent.checkRequired();
                        }
                });
        }

(same for conversion and generic validator checks).

Maybe I miss something, but it looks to me someone has been a bit
sloppy there! :)

Validation *should* only be done for visible components, correct?

Eelco


On 4/3/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> no, this will not work. form component's that are not visible are also not
> updated.
>
>
> -Igor
>
>
> On 4/3/06, Bennett, Timothy (JIS - Applications) <
> [EMAIL PROTECTED]> wrote:
> >
> >
> > Michael Jouravlev's Wicket Wizard code renders a whole set of panels (as
> part of the wizard) and then uses a construct like:
> >
> >     public void updatePanels() {
> >         log.info("--> wizard.updatePanels, step name: " +
> >                  (wizard != null ? wizard.getCurrentStepName() : "null"));
> >
> >         for (int i = 0; i < wizardPanels.length; i++) {
> >             wizardPanels[i].setVisible(
> >                 wizard != null &&
> >                 ("wp"+i).equals(wizard.getCurrentStepName())
> >             );
> >         }
> >     }
> >
> >
> > To set the panel visibility flag for the selected panel... thinking I
> could use something like this in a modified TabbedPanel component that is
> form friendly...
> >
> >
> > ________________________________
>  From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Igor Vaynberg
> > Sent: Monday, April 03, 2006 12:19 PM
> > To: wicket-user@lists.sourceforge.net
> > Subject: Re: [Wicket-user] Validations and the TabbedPanel
> >
> >
> >
> > tabbedpanel isnt really meant to be used to cover up form components, so
> you are right, what you need is a tabbedpanel that uses dhtml instead of a
> server roundtrip.
> >
> > -Igor
> >
> >
> >
> > On 4/3/06, Bennett, Timothy (JIS - Applications)
> <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Wicketeers,
> > >
> > > I'm using the TabbedPanel component in a Wicket 1.1.1 application.
> Works great in a read-only view mode of my data, but using the TabbedPanel
> to present a create/edit form for my data is proving to be a bit
> problematic.  One big issue I'm having is that the validators of my form
> components are only firing for the components that are part of the
> "currently selected" tab panel.  The reason is because the TabbedPanel only
> renders the content of the selected tab, instead of doing some show/hide
> magic with all the tabbed panels.
> > >
> > > Markup for my page looks basically like:
> > >
> > > <form wicket:id="form>
> > >    <input wicket:id="save" type="image" src="images/saveBtn.gif"
> border="0" hspace="6" />
> > >    <input wicket:id="cancel" type="image" src="images/cancelBtn.gif"
> border="0" value="Cancel" hspace="6" />
> > >    <span wicket:id="tabs" class="tabpanel">[tabbed panel will be
> here]</span>
> > > </form>
> > >
> > > As you can see, the TabbedPanel is inside a single form.  I need
> validations to fire on all the component in all the tab panels, not just the
> rendered panel.  My plan is to extend/modify/evolve the TabbedPanel
> component to (something like a TabbedFormPanel component) that effectively
> employs some show/hide magic so that all the panels are available in the
> form for validation.
> > >
> > > Does this sound like the right approach, or am I missing something that
> would be simpler but accomplish the same thing...
> > >
> > > Thanks in advance,
> > >
> > > Timothy
> >
> >
> >
>
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to