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"

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.

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]

Reply via email to