now I understand 1 - you can use different feedback panels for each panel 2 - you can write a custom model for the component label here is a draft, you can create a concrete class from, can override the form component getLabel, can set the custom model on the RadioButtonGenerico constructor...
myRadioButtonGenerico.setLabel(new AbstractReadOnlyModel<String>() { @Override public String getObject() { return getParent().getId() + "-" + getId(); } }); On Tue, Oct 20, 2009 at 2:51 PM, Tomás Rossi <tro...@mecon.gov.ar> wrote: > Yes, but I have 2 panels in the same page, and get: > > * Field 'rapidezAtencion' is required. > * Field 'explicacionClara' is required. > * Field 'resolucionProblema' is required. > * Field 'rapidezAtencion' is required. > * Field 'explicacionClara' is required. > * Field 'resolucionProblema' is required. > > And I want something like: > > * Field 'panel1-rapidezAtencion' is required. > * Field 'panel1-explicacionClara' is required. > * Field 'panel1-resolucionProblema' is required. > * Field 'panel2-rapidezAtencion' is required. > * Field 'panel2-explicacionClara' is required. > * Field 'panel2-resolucionProblema' is required. > > So that I can change those labels with a properties file later. > > > Tom; > > Pedro Santos escribió: > >> Hi Tomás, I didn't found the problem. The feedback panel get: >> >> * Field 'rapidezAtencion' is required. >> * Field 'explicacionClara' is required. >> * Field 'resolucionProblema' is required. >> >> just as expected... >> >> On Tue, Oct 20, 2009 at 12:00 PM, Tomás Rossi <tro...@mecon.gov.ar> >> wrote: >> >> >> >>> Sure, here's the markup (BTW, using Wicket 1.4.2): >>> >>> PanelEncuesta.html (means SurveyPanel): >>> >>> ... >>> <body> >>> >>> <wicket:panel> >>> <table class="GrillaOpciones"> >>> >>> <tr> >>> <th></th> >>> <th><label>Muy Bueno</label></th> >>> <th><label>Bueno</label></th> >>> <th><label>Regular</label></th> >>> <th><label>Malo</label></th> >>> <th><label>Ns/Nc</label></th> >>> </tr> >>> >>> <tr> >>> <wicket:container wicket:id="rapidezAtencion"> >>> <td class="TextoItem"><label>Rapidez en la atención</label></td> >>> <td><input type="radio" wicket:id="rapidezAtencion0"/></td> >>> <td><input type="radio" wicket:id="rapidezAtencion1"/></td> >>> <td><input type="radio" wicket:id="rapidezAtencion2"/></td> >>> <td><input type="radio" wicket:id="rapidezAtencion3"/></td> >>> <td><input type="radio" wicket:id="rapidezAtencion4"/></td> >>> </wicket:container> >>> </tr> >>> >>> <tr> >>> <wicket:container wicket:id="explicacionClara"> >>> <td class="TextoItem"><label>Explicaciones claras</label></td> >>> <td><input type="radio" wicket:id="explicacionClara0"/></td> >>> <td><input type="radio" wicket:id="explicacionClara1"/></td> >>> <td><input type="radio" wicket:id="explicacionClara2"/></td> >>> <td><input type="radio" wicket:id="explicacionClara3"/></td> >>> <td><input type="radio" wicket:id="explicacionClara4"/></td> >>> </wicket:container> >>> </tr> >>> >>> <tr> >>> <wicket:container wicket:id="resolucionProblema"> >>> <td class="TextoItem"><label>Resolución del problema</label></td> >>> <td><input type="radio" wicket:id="resolucionProblema0"/></td> >>> <td><input type="radio" wicket:id="resolucionProblema1"/></td> >>> <td><input type="radio" wicket:id="resolucionProblema2"/></td> >>> <td><input type="radio" wicket:id="resolucionProblema3"/></td> >>> <td><input type="radio" wicket:id="resolucionProblema4"/></td> >>> </wicket:container> >>> </tr> >>> >>> </table> >>> </wicket:panel> >>> >>> </body> >>> ... >>> >>> PantallaEncuesta.html (means SurveyScreen): >>> ... >>> <div class="Sector"> >>> >>> <h3>¿Cómo calificaría los siguientes aspectos de la atención telefónica >>> de >>> Informática?</h3> >>> <div wicket:id="panelTelefonico">Acá va la encuesta de atención >>> telefónica</div> <!-- Here goes the panel!! --> >>> >>> </div> >>> >>> <div class="Sector"> >>> >>> <h3>¿Cómo calificaría los siguientes aspectos de la atención del personal >>> de Informática?</h3> >>> <div wicket:id="panelPersonal">Acá va la encuesta de atención >>> personal</div> <!-- Here goes the panel!! --> >>> >>> </div> >>> ... >>> >>> -- >>> Tom; >>> >>> Pedro Santos escribió: >>> >>> Hi Tómas, >>> >>> >>>> What the form component RadioButtonGenerico receive as id, the >>>> validation >>>> message will use as label. The code should generate the outputs: >>>> * Field 'rapidezAtencion' is required. >>>> * Field 'explicacionClara' is required. >>>> >>>> your report output : >>>> <wicket:container wicket:id="score"> >>>> is an generic markup or always the "score" id is placed on html? If so, >>>> can >>>> you send the panel html? what wicket version are you using? >>>> >>>> On Mon, Oct 19, 2009 at 5:56 PM, Tomás Rossi <tro...@mecon.gov.ar> >>>> wrote: >>>> >>>> >>>> >>>> >>>> >>>>> 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 >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> --------------------------------------------------------------------- >>> 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 > > -- Pedro Henrique Oliveira dos Santos