Here goes the java code...

RadioButtonGenerico.java (means GenericRadioButton):

public class RadioButtonGenerico<T> extends RadioGroup<T> {

   private static final long serialVersionUID = -1725627853431547878L;

public RadioButtonGenerico(String id, List<String> opciones, IModel<T> modelo) {
       super(id, modelo);

       for (int i = 0; i < opciones.size(); i++) {
           add(new Radio<Integer>(id + i, new Model<Integer>(i)));
       }
   }
}

PanelEncuesta.java (means SurveyPanel):

public class PanelEncuesta extends FormComponentPanel<DatosEncuesta> {

   private static final long serialVersionUID = -1545571698439481842L;

   public PanelEncuesta(String id, IModel<DatosEncuesta> modelo) {
super(id, modelo);
       add(new RadioButtonGenerico<DatosEncuesta>("rapidezAtencion",
               DatosEncuesta.CALIFICACIONES,
new PropertyModel<DatosEncuesta>(modelo, "rapidezAtencion")).setRequired(true));

       add(new RadioButtonGenerico<DatosEncuesta>("explicacionClara",
               DatosEncuesta.CALIFICACIONES,
new PropertyModel<DatosEncuesta>(modelo, "explicacionClara")).setRequired(true));
       add(new RadioButtonGenerico<DatosEncuesta>("resolucionProblema",
               DatosEncuesta.CALIFICACIONES,
new PropertyModel<DatosEncuesta>(modelo, "resolucionProblema")).setRequired(true)); }

}

PantallaEncuesta.java: (means SurveyScreen):

public class PantallaEncuesta extends WebPage {

   public PantallaEncuesta() {
       add(new FeedbackPanel("feedback"));
       add(new FormEncuesta("formEncuesta"));
   }

public static class FormEncuesta extends Form<DatosEncuesta> { // (Means SurveyForm)
       private static final long serialVersionUID = 8582266005577827473L;

       // Modelo para las respuestas respecto a la atención éfonica.
private final DatosEncuesta datosEncuestaTelefonico = new DatosEncuesta();
       // Modelo para las respuestas respecto a la atención personal.
private final DatosEncuesta datosEncuestaPersonal = new DatosEncuesta();
       // Modelo para los datos optativos de la encuesta.
       private final DatosOptativos datosOptativos = new DatosOptativos();

       private CaptchaImageResource captcha = new CaptchaImageResource();
       private final ValueMap claveCaptcha = new ValueMap();

       public FormEncuesta(String id) {
           super(id);
           ...
           add(new PanelEncuesta("panelTelefonico",
                   new Model<DatosEncuesta>(datosEncuestaTelefonico)));
           add(new PanelEncuesta("panelPersonal",
                   new Model<DatosEncuesta>(datosEncuestaPersonal)));
... }
...

Pedro Santos escribió:
Actually the panel wicket id is an parameter for panel constructor, can you
some code?

On Mon, Oct 19, 2009 at 5:07 PM, Tomás Rossi <tro...@mecon.gov.ar> wrote:

Then I'm unable to use the properties file for tweaking the string in
question.

What is the beauty of panels if they don't prefix its internal ids
automatically? Or am I getting it all wrong... :S

Tom;

Igor Vaynberg escribió:

 call radiogroup.setlabel()
-igor

On Mon, Oct 19, 2009 at 10:55 AM, Tomás Rossi <tro...@mecon.gov.ar>
wrote:


Hi,

We are building a simple survey with Wicket.

Essentially, we have a lot of RadioGroup components repeated all over the
main survey page. Those components are in fact the same thing (to score
some
item), but obviously, they reffer to different subjects/groups. For
example:

Are you happy with X?

In doing job A: ( ) very happy
( ) not so much
( ) sucks

In doing job B: ( ) very happy
( ) not so much
( ) sucks

Are you happy with Y?

In doing job A: ( ) very happy
( ) not so much
( ) sucks
 ....

So we decided to make a reusable component (a panel) for the score input,
and repeat it as much as we needed.

We also have our survey page with a feedback panel and a form. Inside
that
form we include the panel many times, one for each item. But the
required-field-feedback shows the same wicket:id for a bunch of fields,
which isn't what we want. We need a unique wicket:id for each instance of
the score input.

E.G.

Our Panel is like this:

...
<tr>
 <wicket:container  wicket:id="score">
 <td><input type="radio" wicket:id="optGood"/></td>
 <td><input type="radio" wicket:id="optNotSoMuch"/></td>
 <td><input type="radio" wicket:id="optSucks"/></td>
 </wicket:container>
</tr>
...

And our feedback is like this:

* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.
* Field 'score' is required.

How can I solve this?

Thanks
Tom;


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to