there is a FormComponentPanel that can embed other form components, and act
as a formcomponent itself. and actually wicket does support embedded forms.

-igor


On 4/9/07, Carlos Pita <[EMAIL PROTECTED]> wrote:

Hi all,

suppose you have to implement some form input component that is
composed from other simple FormComponents. These simple input fields
will be ajax-validated individually, and they will be subject to some
global (inter-field) validation too. An example could be three
drop-downs for a date, with local validation requiring each field and
global validation asking for a valid Gregorian calendar date. AFAIK
there are nothing like nested forms in wicket, you have a form and
then at the next level its FormComponents and that's all. So I tend to
think of a static helper method that instantiates the individual form
fields and registers them with the form. Maybe there must be some
"synthetic" invisible component just to attach feedback from the date
global-validation, which will be implemented as a form validator. For
example:

class MyForm extends Form {

   public MyForm(String id) {
      ....
      DateComponent.add(this, "birthDate");
      ....
   }
}

<select wicket:id="birthDate.day"/>
<span wicket:id="birthDate.day.feedback"></span>

<select wicket:id="birthDate.month"/>
<span wicket:id="birthDate.month.feedback"></span>

<select wicket:id="birthDate.year"/>
<span wicket:id="birthDate.year.feedback"></span>

<span wicket:id="birthDate"></span> <!-- dummy component -->
<span wicket:id="birthDate.feedback"></span>


There are two things in this approach that I don't particularly like:

1) Having a dummy component to attach date global-validation errors
(notice that they are not the same as form errors).

2) The procedural nature of the solution, there is no real Date component.

What do you think? Do you have a better alternative that is not too
convolved?

Best regards,
Carlos

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to