Hi, Ivan!

On Thu, Dec 8, 2011 at 4:40 AM, Ivan Furdi <[email protected]> wrote:
> Hi Gilberto,
>
> I did try something along those lines :
>
> tabbedPanel.getTabLink().setAttribute("onclick", "return
> window.confirm('message')" );
>
> but it doesn't work . For example
> tabbedPanel.getTabLink().setParameter(name, value) works properly.
>

I think you forgot to set the control's listener. Did you?
For example:

ActionLink link = tabbedPanel.getTabLink();
link.setListener(this, "onClickFocus");


> I was setting this up in onInit() method.
>
> To explain a bit further, maybe there are some easier methods to achieve it
>  - I have a tabbedPanel with 2
> panels each containing a input Form (forms are completely different and I
> use them to save data to 2 different tables).
> What I want to do is ask a user if he wants to save his current input (form1
> for example) and move to another tab or just move
> to second tab without saving.

Another way to do it is set the TabListener[1].

regards,

Gilberto
[1] 
http://click.apache.org/docs/extras-api/org/apache/click/extras/panel/TabbedPanel.html#setTabListener(org.apache.click.ActionListener)

>
> Regards,
> Ivan
>
>
> On 6.12.2011 20:40, Gilberto wrote:
>>
>> Since TabbedPanel[1] has ActionLink as instance variable ...
>> I guess you can do the .setAttribute("onClick", "javascript:<  your
>> javascript code>")[2] with that Click Control.
>>
>> Hope this helps
>>
>> Gilberto
>>
>> [1]
>> http://click.apache.org/docs/extras-api/org/apache/click/extras/panel/TabbedPanel.html
>> [2]
>> http://click.apache.org/docs/click-api/org/apache/click/control/AbstractControl.html?is-external=true#setAttribute(java.lang.String,%20java.lang.String)
>>
>>
>>
>> On Tue, Dec 6, 2011 at 9:12 AM, Ivan Furdi<[email protected]>  wrote:
>>>
>>> Hi all,
>>>
>>> Im doing something with tabbed panels and was wondering how to add some
>>> confirm dialog on tab switch?
>>>
>>> For example I have 2 tabs and when I switch between them i would like to
>>> ask
>>> a user about some action ("Do you want to do ....." etc.)
>>>
>>> Any ideas?
>>>
>>> Thx

Reply via email to