Link on option CheckList

7 messages Options
Embed this post
Permalink
easydoor-4

Link on option CheckList

Reply Threaded More More options
Print post
Permalink
Hi all,
I'd like to add a link on each option of a CheckList to display a jQuery
tootip.
I tried to use the HtmlStringBuffer with the render method on each option.
But this render method refers to a Select List and not a CheckList

Thank you for your help

Naoki Takezoe

Re: Link on option CheckList

Reply Threaded More More options
Print post
Permalink
Hi easydoor,

You have to override CheckList#render().

Other solution,
It would be possible to decorate <li> by JavaScript.
CheckList renders following HTML:

<ul id="form_name_ul">
  <li>
    <label for="name_0" class="checkListLabel">
    <input type="checkbox"  value="1" id="name_0"
name="standardList"/>Item 1</label>
  </li>
  <li>
    <label for="name_1" class="checkListLabel">
    <input type="checkbox"  value="2" id="name_1"
name="standardList"/>Item 2</label>
  </li>
</ul>

You would be able to pick <li> and insert <a> using JavaScript.

Hope this helps!

2009/9/10 easydoor <[hidden email]>:
> Hi all,
> I'd like to add a link on each option of a CheckList to display a jQuery
> tootip.
> I tried to use the HtmlStringBuffer with the render method on each option.
> But this render method refers to a Select List and not a CheckList
>
> Thank you for your help
>
>

--
Naoki Takezoe
Bob Schellink-2

Re: Link on option CheckList

Reply Threaded More More options
Print post
Permalink
Agree with Naoki, just use jQuery to decorate the markup rendered by Click.

There are many jQuery tip plugins that does this e.g:

http://plugins.learningjquery.com/cluetip/

kind regards

bob


Naoki Takezoe wrote:

> Hi easydoor,
>
> You have to override CheckList#render().
>
> Other solution,
> It would be possible to decorate <li> by JavaScript.
> CheckList renders following HTML:
>
> <ul id="form_name_ul">
>   <li>
>     <label for="name_0" class="checkListLabel">
>     <input type="checkbox"  value="1" id="name_0"
> name="standardList"/>Item 1</label>
>   </li>
>   <li>
>     <label for="name_1" class="checkListLabel">
>     <input type="checkbox"  value="2" id="name_1"
> name="standardList"/>Item 2</label>
>   </li>
> </ul>
>
> You would be able to pick <li> and insert <a> using JavaScript.
>
> Hope this helps!
>
> 2009/9/10 easydoor <[hidden email]>:
>> Hi all,
>> I'd like to add a link on each option of a CheckList to display a jQuery
>> tootip.
>> I tried to use the HtmlStringBuffer with the render method on each option.
>> But this render method refers to a Select List and not a CheckList
>>
>> Thank you for your help
>>
>>
>

easydoor-4

Re: Link on option CheckList

Reply Threaded More More options
Print post
Permalink
In reply to this post by Naoki Takezoe
Naoki Takezoe <takezoe <at> gmail.com> writes:

>
> Hi easydoor,
>
> You have to override CheckList#render().
>
> Other solution,
> It would be possible to decorate <li> by JavaScript.
> CheckList renders following HTML:
>
> <ul id="form_name_ul">
>   <li>
>     <label for="name_0" class="checkListLabel">
>     <input type="checkbox"  value="1" id="name_0"
> name="standardList"/>Item 1</label>
>   </li>
>   <li>
>     <label for="name_1" class="checkListLabel">
>     <input type="checkbox"  value="2" id="name_1"
> name="standardList"/>Item 2</label>
>   </li>
> </ul>
>
> You would be able to pick <li> and insert <a> using JavaScript.
>
> Hope this helps!
>
> 2009/9/10 easydoor <christophe.foiret <at> valdoise.fr>:
> > Hi all,
> > I'd like to add a link on each option of a CheckList to display a jQuery
> > tootip.
> > I tried to use the HtmlStringBuffer with the render method on each option.
> > But this render method refers to a Select List and not a CheckList
> >
> > Thank you for your help
> >
> >
>
What do you say by override CheckList render ?
I tried to use the HtmlStringBuffer with the render method on each option
but this render method refers to a Select List and not a CheckList

        HtmlStringBuffer buffer = new HtmlStringBuffer();
        buffer.elementStart("a");
        buffer.appendAttribute("href", "http://www.valdoise.fr");
        buffer.elementEnd();

        Option option = new Option("First Option");
        option.render(CheckList, buffer);<-- there is a pbm here, the first
argument is for a Select List not a CheckList

For the other solution in JS, how do you decorate the CheckList Option ?

Thanks




Naoki Takezoe

Re: Link on option CheckList

Reply Threaded More More options
Print post
Permalink
Hi easydoor,

2009/9/14 easydoor <[hidden email]>:
> Naoki Takezoe <takezoe <at> gmail.com> writes:
>
> What do you say by override CheckList render ?
> I tried to use the HtmlStringBuffer with the render method on each option
> but this render method refers to a Select List and not a CheckList

CheckList does not use Option#render() to render items.
See the source code of CheckList:
http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/CheckList.java?view=markup

You have to create subclass of CheckList and override
render() method to generate HTML you want.

> For the other solution in JS, how do you decorate the CheckList Option ?

This is a jQuery example:

<script type="text/javascript">
$(document).ready(function(){
  $('ul#form_name_ul li').wrap('<a href="http://www.google.co.jp"></a>');
});
</script>

--
Naoki Takezoe
easydoor-4

Re: Link on option CheckList

Reply Threaded More More options
Print post
Permalink
Naoki Takezoe <takezoe <at> gmail.com> writes:

>
> Hi easydoor,
>
> 2009/9/14 easydoor <christophe.foiret <at> valdoise.fr>:
> > Naoki Takezoe <takezoe <at> gmail.com> writes:

> You have to create subclass of CheckList and override
> render() method to generate HTML you want.

OK, the override CheckList render works well if you put the same URL on all
options, but i want to put a specific URL on each option
By this way it doesn't work, do you have an idea ?




Naoki Takezoe

Re: Link on option CheckList

Reply Threaded More More options
Print post
Permalink
2009/9/14 easydoor <[hidden email]>:
>
> OK, the override CheckList render works well if you put the same URL on all
> options, but i want to put a specific URL on each option
> By this way it doesn't work, do you have an idea ?
>

I understood.
I think you have to extend both Opition and CheckList.

--
Naoki Takezoe