you are welcome
-igor
On 8/13/07, Justin Morgan (Logic Sector) <[EMAIL PROTECTED]> wrote:
>
> Woo, that worked! Although I changed the label to a span (not a div)
> because I wanted it to show up on the same line as the checkbox itself.
>
> In case anyone's interested, here's the complete "test case" solution
> where I add this to my form component:
>
> <input type="checkbox" wicket:id="cb"/>
> <span wicket:id="label">
> I agree to the
> <a wicket:id="terms">Terms of Use</a>
> and
> <a wicket:id="policy">Submission Policy</a>
> </span>
>
>
> Model cbModel = new Model();
> cbModel.setObject(Boolean.FALSE);
> final CheckBox cb = new CheckBox("cb", cbModel);
> cb.setLabel(new Model("I agree to the Terms of Use and the
> Submission Policy"));
> cb.setOutputMarkupId(true);
> cb.setRequired(true);
> form.add(cb);
>
> WebMarkupContainer label = new WebMarkupContainer("label") {
> @Override
> protected void onComponentTag(final ComponentTag tag) {
> tag.put("for", cb.getMarkupId());
> }
> };
> form.add(label);
> label.add(new PageLink("terms", TermsPage.class));
> label.add(new PageLink("policy", PolicyPage.class));
>
> Later I'll change it so the links pop up in their own windows.
>
> Thanks again!
>
> Justin
>
> On Aug 13, 2007, at 11:11 AM, Igor Vaynberg wrote:
>
> > On 8/13/07, Justin Morgan (Logic Sector) <[EMAIL PROTECTED]>
> > wrote:
> >>
> >> Thanks very much for your help. I tried this and it looks correct on
> >> the page. However, there are two problems that I still need help
> >> with.
> >>
> >> PROBLEM 1 -- Requiredness message is wrong
> >> Submitting the form results in:
> >> "field 'cb' is required"
> >> The requiredness message needs to be:
> >> "field 'I agree to the Terms of Use and the Submission
> >> Policy' is required"
> >
> >
> > cb.setlabel(new model("I agree to the ...."));
> >
> > PROBLEM 2 -- Hyperlink click issue:
> >> Clicking either hyperlink inadvertently checks and unchecks the
> >> checkbox
> >>
> >> I think the label "I agree to the Terms of Use and the Submission
> >> Policy" needs to be a label in the Wicket sense of a labeled field so
> >> the requiredness message shows up correctly...It should not be an
> >> HTML "label" element because that means clicking a hyperlink checks/
> >> unchecks the box. I'm just not sure how to go about this.
> >
> >
> > so change <label> to <div> :)
> >
> > -igor
> >
> >
> >
> > Thanks again for any help,
> >>
> >> Justin
> >>
> >> On Aug 10, 2007, at 11:04 AM, Igor Vaynberg wrote:
> >>
> >>> final CheckBox cb=new CheckBox("cb");
> >>> cb.setOutputMarkupId(true);
> >>>
> >>> WebMarkupContainer label=new WebMarkupContainer("label") {
> >>> oncomponenttag(tag) { tag.put("for", cb.getMarkupId()); }
> >>> label.add(new PageLink("terms", TermsPage.class));
> >>> label.add(new PageLink("policy", PolicyPage.class));
> >>>
> >>>
> >>> <input type="checkbox" wicket:id="cb"/><label
> >>> wicket:id="label">agree to the
> >>> <a wicket:id="terms">terms of use</a> and <a
> >>> wicket:id="policy>submission
> >>> policy</a></label>
> >>>
> >>> -igor
> >>>
> >>>
> >>>
> >>> On 8/10/07, Justin Morgan (Logic Sector) <[EMAIL PROTECTED]>
> >>> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> I asked this question before but didn't really understand the
> >>>> response. I need to create a CheckBox at the bottom of a form
> >>>> (ordinarily this is easy enough). The tricky part is that the
> >>>> check
> >>>> box's label will contain two hyperlinks that correspond to the
> >>>> underlined text in the example below:
> >>>>
> >>>> [x] I agree to the _Terms_of_Use_ and the
> >>>> _Submission_Policy_
> >>>>
> >>>> In the markup I could place the CheckBox labeled with "I agree to
> >>>> the", then place a terms of use Link, then a Label ("and the"),
> >>>> then
> >>>> another submission policy Link. That would solve my problem except
> >>>> the CheckBox is *required*. The requiredness error message
> >>>> would say
> >>>> something like:
> >>>> field 'I agree to the' is required
> >>>> and obviously that's not ideal for users.
> >>>>
> >>>> Since Wicket is all about OOP, should I create a subclass of
> >>>> CheckBox? What's the best approach? If there are any examples
> >>>> similar to this, I'd greatly appreciate hearing about it.
> >>>>
> >>>> Thanks for any help,
> >>>>
> >>>> Justin
> >>>>
> >>>> On Jun 12, 2007, at 11:56 PM, Timo Rantalaiho wrote:
> >>>>
> >>>>> On Tue, 12 Jun 2007, Justin Morgan (Logic Sector) wrote:
> >>>>>> My question is: How to I create a label that displays an error
> >>>>>> message correctly, yet also contains hyperlinks within the label?
> >>>>>
> >>>>> Make it a WebMarkupContainer that has the logic and
> >>>>> necessary child components.
> >>>>>
> >>>>> - Timo
> >>>>>
> >>>>
> >>>>
> >>>> -------------------------------------------------------------------
> >>>> --
> >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
>
>