You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Praveen Kumar A." <pr...@sonata-software.com> on 2009/05/05 17:54:40 UTC
FW: need help urgent......Change label dynamicly
Hello,
I want to change the Label for the AjaxButton, when it is clicked. Iam
not able to work out this.
new AjaxButton("preview"){
public void onSubmit(AjaxRequestTarget target, Form form){
// need to get the label name here...how to get the label name?
if(AjaxButton.label.equal("click")) then set label to "Unclick"
if "UnClick" then show "click"
}
Need urgently, stopping my work. Could you please give me hint, how to
do this Implementation.
Thanks,
Praveen
Re: FW: need help urgent......Change label dynamicly
Posted by Janos Cserep <cs...@metaprime.hu>.
And of course don't forget to add the button or a parent component to
the ajaxrequesttarget as well.
On Wed, May 6, 2009 at 11:58 AM, Janos Cserep <cs...@metaprime.hu> wrote:
> AFAIR a button's label comes from it's Model. So you should do:
>
> new AjaxButton("preview"){
>
> public void onSubmit(AjaxRequestTarget target, Form form){
> String label = getModelObject(); // or
> getDefaultModelObject(); if 1.4
> if ("click".equals(label) {
> getModel().setObject("unclick); // or
> getDefaultModel().setObject("unclick") in case you're at 1.4
> }
> }
> }.setModel("click);
>
>
> On Wed, May 6, 2009 at 11:44 AM, nino martinez wael
> <ni...@gmail.com> wrote:
>> Maybe to it with an attribute modifier.. I cant remember ajaxbutton..
>>
>> 2009/5/6 Per Newgro <pe...@gmx.ch>:
>>> Maybe you could add two buttons and set the other visible?
>>>
>>> Cheers
>>> Per
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FW: need help urgent......Change label dynamicly
Posted by Janos Cserep <cs...@metaprime.hu>.
AFAIR a button's label comes from it's Model. So you should do:
new AjaxButton("preview"){
public void onSubmit(AjaxRequestTarget target, Form form){
String label = getModelObject(); // or
getDefaultModelObject(); if 1.4
if ("click".equals(label) {
getModel().setObject("unclick); // or
getDefaultModel().setObject("unclick") in case you're at 1.4
}
}
}.setModel("click);
On Wed, May 6, 2009 at 11:44 AM, nino martinez wael
<ni...@gmail.com> wrote:
> Maybe to it with an attribute modifier.. I cant remember ajaxbutton..
>
> 2009/5/6 Per Newgro <pe...@gmx.ch>:
>> Maybe you could add two buttons and set the other visible?
>>
>> Cheers
>> Per
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FW: need help urgent......Change label dynamicly
Posted by nino martinez wael <ni...@gmail.com>.
Maybe to it with an attribute modifier.. I cant remember ajaxbutton..
2009/5/6 Per Newgro <pe...@gmx.ch>:
> Maybe you could add two buttons and set the other visible?
>
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: FW: need help urgent......Change label dynamicly
Posted by Per Newgro <pe...@gmx.ch>.
Maybe you could add two buttons and set the other visible?
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org