Question

I want to create a check box with the text "I agree to the Terms and Services" in gwt. But I only want the link to work on the phrase "Terms and Services". It seems that with anchor the whole text works as a hyperlink. Is there some way I can only make a selected few words of the same anchor appear as a hyperlink? Or is there possibly a way to add two different hyperlinks inside the same anchor?

Was it helpful?

Solution

    CheckBox cb = new CheckBox();
    cb.setHTML("I agree to the <a href='#'>Terms and Services</a>");

I hope I get your idea :)

OTHER TIPS

Let's do it with UiBinder:

<g:HTMLPanel>
  <label>
    <g:SimpleCheckBox ui:field="checkbox" />
    I agree to the
    <g:Anchor ui:field="terms">Terms and Services</g:Anchor>
  </label>
</g:HTMLPanel>

There are so many ways of doing it, depending on how you want to respond to events (IFF you want to respond to events).

But going down to HTML with the help of UiBinder really is the way to go: don't overuse widgets.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top