You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by drizzo <da...@accenture.com> on 2009/03/26 12:10:08 UTC

Javascript in button element

Hi everybody,

i have this code:

<tr:commandButton id="responseButton"
		action="#{responseMgdBean.rResponse}"
		icon="/images/ico_#{responseButton.behaviour}.gif"
		binding="#{dealCalculatorMgdBean.buttonAccepted}"
		text="#{responseButton.label}  "
		rendered="#{responseButton.visible}"
		shortDesc="#{responseButton.responseValue}" blocking="true">
		<tr:setActionListener from="#{responseButton.responseValue}"
			to="#{responseMgdBean.responseValue}" />
		<tr:setActionListener from="#{responseButton.behaviour}"
			to="#{responseMgdBean.behaviour}" />
		<tr:setActionListener
			from="#{dealCalculatorMgdBean.dealVariantIds}"
			to="#{responseMgdBean.selectedVariantIds}" />
</tr:commandButton>

now I should run a js code before or after to execute the action.
Which the best solution to do this?
Is it possible use the onClick attribute?

Please can you help me?

Thanks


-- 
View this message in context: http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Javascript in button element

Posted by Simon Kitching <sk...@apache.org>.
Maybe he means that the JSF page is in a popup window?
Or maybe it is in an html Frame?

Danilo, you need to write your question better. We cannot read your mind
and guess what you are really asking about...


Rafa Pérez schrieb:
> Parent page? If you are inside a dialog, then you can define a
> returnListener method in the opener button to execute some logic when
> the dialog is closed.
> 
> HTH,
> 
> -- Rafa
> 
> On Thu, Mar 26, 2009 at 2:54 PM, drizzo <danilo.rizzo@accenture.com
> <ma...@accenture.com>> wrote:
> 
> 
>     i should notify to parent page the result of the action. so i need
>     wait the
>     action is finished...
> 
>     i don't if is it possible
> 
>     Danilo
> 
> 
>     Simon Kitching wrote:
>     >
>     > For normal command-button usage, the current html page is
>     submitted and
>     > *completely* replaced by a new HTML page. So it makes no sense to talk
>     > about running javascript "after" the action.
>     >
>     > Are you perhaps using these command-buttons within an AJAX pane, and
>     > want some javascript to execute after the AJAX request that the button
>     > triggers has completed?
>     >
>     >
>     > drizzo schrieb:
>     >>
>     >> but onClick event is triggered after the action tag or before?
>     >>
>     >> If is before, there is a way to excute a scritp after the action?
>     >>
>     >>
>     >>
>     >> Anton Gavazuk wrote:
>     >>> Of course use onClick attribute.
>     >>>
>     >>> 2009/3/26 drizzo <danilo.rizzo@accenture.com
>     <ma...@accenture.com>>
>     >>>
>     >>>> Hi everybody,
>     >>>>
>     >>>> i have this code:
>     >>>>
>     >>>> <tr:commandButton id="responseButton"
>     >>>>                action="#{responseMgdBean.rResponse}"
>     >>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>     >>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>     >>>>                text="#{responseButton.label}  "
>     >>>>                rendered="#{responseButton.visible}"
>     >>>>                shortDesc="#{responseButton.responseValue}"
>     >>>> blocking="true">
>     >>>>                <tr:setActionListener
>     >>>> from="#{responseButton.responseValue}"
>     >>>>                        to="#{responseMgdBean.responseValue}" />
>     >>>>                <tr:setActionListener
>     from="#{responseButton.behaviour}"
>     >>>>                        to="#{responseMgdBean.behaviour}" />
>     >>>>                <tr:setActionListener
>     >>>>                      
>      from="#{dealCalculatorMgdBean.dealVariantIds}"
>     >>>>                      
>      to="#{responseMgdBean.selectedVariantIds}" />
>     >>>> </tr:commandButton>
>     >>>>
>     >>>> now I should run a js code before or after to execute the action.
>     >>>> Which the best solution to do this?
>     >>>> Is it possible use the onClick attribute?
>     >>>>
>     >>>> Please can you help me?
>     >>>>
>     >>>> Thanks
>     >>>>

Re: Javascript in button element

Posted by drizzo <da...@accenture.com>.

is the string identifier for the new page... and before to load the new page
i should run a javascript



Anton Gavazuk wrote:
> 
> WHat is the result of button execution? New page?
> 
> 2009/3/26 drizzo <da...@accenture.com>
> 
>>
>>
>>  No i have an iframe, when the button is clicked must be execute the
>> method
>> specified in the action attribute, and after I should call a javascript
>> function (this is used to notify to a parent page the outcome)
>>
>> Thanks
>>
>> D.
>>
>>
>> Rafa Pérez wrote:
>> >
>> > Parent page? If you are inside a dialog, then you can define a
>> > returnListener method in the opener button to execute some logic when
>> the
>> > dialog is closed.
>> >
>> > HTH,
>> >
>> > -- Rafa
>> >
>> > On Thu, Mar 26, 2009 at 2:54 PM, drizzo <da...@accenture.com>
>> > wrote:
>> >
>> >>
>> >> i should notify to parent page the result of the action. so i need
>> wait
>> >> the
>> >> action is finished...
>> >>
>> >> i don't if is it possible
>> >>
>> >> Danilo
>> >>
>> >>
>> >> Simon Kitching wrote:
>> >> >
>> >> > For normal command-button usage, the current html page is submitted
>> and
>> >> > *completely* replaced by a new HTML page. So it makes no sense to
>> talk
>> >> > about running javascript "after" the action.
>> >> >
>> >> > Are you perhaps using these command-buttons within an AJAX pane, and
>> >> > want some javascript to execute after the AJAX request that the
>> button
>> >> > triggers has completed?
>> >> >
>> >> >
>> >> > drizzo schrieb:
>> >> >>
>> >> >> but onClick event is triggered after the action tag or before?
>> >> >>
>> >> >> If is before, there is a way to excute a scritp after the action?
>> >> >>
>> >> >>
>> >> >>
>> >> >> Anton Gavazuk wrote:
>> >> >>> Of course use onClick attribute.
>> >> >>>
>> >> >>> 2009/3/26 drizzo <da...@accenture.com>
>> >> >>>
>> >> >>>> Hi everybody,
>> >> >>>>
>> >> >>>> i have this code:
>> >> >>>>
>> >> >>>> <tr:commandButton id="responseButton"
>> >> >>>>                action="#{responseMgdBean.rResponse}"
>> >> >>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>> >> >>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>> >> >>>>                text="#{responseButton.label}  "
>> >> >>>>                rendered="#{responseButton.visible}"
>> >> >>>>                shortDesc="#{responseButton.responseValue}"
>> >> >>>> blocking="true">
>> >> >>>>                <tr:setActionListener
>> >> >>>> from="#{responseButton.responseValue}"
>> >> >>>>                        to="#{responseMgdBean.responseValue}" />
>> >> >>>>                <tr:setActionListener
>> >> from="#{responseButton.behaviour}"
>> >> >>>>                        to="#{responseMgdBean.behaviour}" />
>> >> >>>>                <tr:setActionListener
>> >> >>>>
>> >> from="#{dealCalculatorMgdBean.dealVariantIds}"
>> >> >>>>                        to="#{responseMgdBean.selectedVariantIds}"
>> />
>> >> >>>> </tr:commandButton>
>> >> >>>>
>> >> >>>> now I should run a js code before or after to execute the action.
>> >> >>>> Which the best solution to do this?
>> >> >>>> Is it possible use the onClick attribute?
>> >> >>>>
>> >> >>>> Please can you help me?
>> >> >>>>
>> >> >>>> Thanks
>> >> >>>>
>> >> >>>>
>> >> >>>> --
>> >> >>>> View this message in context:
>> >> >>>>
>> >>
>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
>> >> >>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >> >>>>
>> >> >>>>
>> >> >>>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22722528.html
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22723296.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Javascript-in-button-element-tp22719877p22726164.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Javascript in button element

Posted by Anton Gavazuk <an...@gmail.com>.
WHat is the result of button execution? New page?

2009/3/26 drizzo <da...@accenture.com>

>
>
>  No i have an iframe, when the button is clicked must be execute the method
> specified in the action attribute, and after I should call a javascript
> function (this is used to notify to a parent page the outcome)
>
> Thanks
>
> D.
>
>
> Rafa Pérez wrote:
> >
> > Parent page? If you are inside a dialog, then you can define a
> > returnListener method in the opener button to execute some logic when the
> > dialog is closed.
> >
> > HTH,
> >
> > -- Rafa
> >
> > On Thu, Mar 26, 2009 at 2:54 PM, drizzo <da...@accenture.com>
> > wrote:
> >
> >>
> >> i should notify to parent page the result of the action. so i need wait
> >> the
> >> action is finished...
> >>
> >> i don't if is it possible
> >>
> >> Danilo
> >>
> >>
> >> Simon Kitching wrote:
> >> >
> >> > For normal command-button usage, the current html page is submitted
> and
> >> > *completely* replaced by a new HTML page. So it makes no sense to talk
> >> > about running javascript "after" the action.
> >> >
> >> > Are you perhaps using these command-buttons within an AJAX pane, and
> >> > want some javascript to execute after the AJAX request that the button
> >> > triggers has completed?
> >> >
> >> >
> >> > drizzo schrieb:
> >> >>
> >> >> but onClick event is triggered after the action tag or before?
> >> >>
> >> >> If is before, there is a way to excute a scritp after the action?
> >> >>
> >> >>
> >> >>
> >> >> Anton Gavazuk wrote:
> >> >>> Of course use onClick attribute.
> >> >>>
> >> >>> 2009/3/26 drizzo <da...@accenture.com>
> >> >>>
> >> >>>> Hi everybody,
> >> >>>>
> >> >>>> i have this code:
> >> >>>>
> >> >>>> <tr:commandButton id="responseButton"
> >> >>>>                action="#{responseMgdBean.rResponse}"
> >> >>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
> >> >>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
> >> >>>>                text="#{responseButton.label}  "
> >> >>>>                rendered="#{responseButton.visible}"
> >> >>>>                shortDesc="#{responseButton.responseValue}"
> >> >>>> blocking="true">
> >> >>>>                <tr:setActionListener
> >> >>>> from="#{responseButton.responseValue}"
> >> >>>>                        to="#{responseMgdBean.responseValue}" />
> >> >>>>                <tr:setActionListener
> >> from="#{responseButton.behaviour}"
> >> >>>>                        to="#{responseMgdBean.behaviour}" />
> >> >>>>                <tr:setActionListener
> >> >>>>
> >> from="#{dealCalculatorMgdBean.dealVariantIds}"
> >> >>>>                        to="#{responseMgdBean.selectedVariantIds}"
> />
> >> >>>> </tr:commandButton>
> >> >>>>
> >> >>>> now I should run a js code before or after to execute the action.
> >> >>>> Which the best solution to do this?
> >> >>>> Is it possible use the onClick attribute?
> >> >>>>
> >> >>>> Please can you help me?
> >> >>>>
> >> >>>> Thanks
> >> >>>>
> >> >>>>
> >> >>>> --
> >> >>>> View this message in context:
> >> >>>>
> >>
> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
> >> >>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>>>
> >> >>>>
> >> >>>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Javascript-in-button-element-tp22719877p22722528.html
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Javascript-in-button-element-tp22719877p22723296.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Javascript in button element

Posted by "Glauco P. Gomes" <gl...@yahoo.com.br>.
With Trinidad you can "execute" javaScript in client side from the 
server side, look this code extracted from Matthias Wessendorf blog[1]:

ExtendedRenderKitService service =  
  Service.getRenderKitService(facesContext,  
    ExtendedRenderKitService.class);
service.addScript(facesContext, "alert('hello Trinidad');");

[1] 
http://matthiaswessendorf.wordpress.com/2008/02/16/using-dojo-and-apache-trinidad/

I think you could use the ExtendedRenderKitService to add the javaScript 
that you need execute after the action is executed.

Glauco P. Gomes

drizzo escreveu:
>  No i have an iframe, when the button is clicked must be execute the method
> specified in the action attribute, and after I should call a javascript
> function (this is used to notify to a parent page the outcome)
>
> Thanks 
>
> D.
>
>
> Rafa Pérez wrote:
>   
>> Parent page? If you are inside a dialog, then you can define a
>> returnListener method in the opener button to execute some logic when the
>> dialog is closed.
>>
>> HTH,
>>
>> -- Rafa
>>
>> On Thu, Mar 26, 2009 at 2:54 PM, drizzo <da...@accenture.com>
>> wrote:
>>
>>     
>>> i should notify to parent page the result of the action. so i need wait
>>> the
>>> action is finished...
>>>
>>> i don't if is it possible
>>>
>>> Danilo
>>>
>>>
>>> Simon Kitching wrote:
>>>       
>>>> For normal command-button usage, the current html page is submitted and
>>>> *completely* replaced by a new HTML page. So it makes no sense to talk
>>>> about running javascript "after" the action.
>>>>
>>>> Are you perhaps using these command-buttons within an AJAX pane, and
>>>> want some javascript to execute after the AJAX request that the button
>>>> triggers has completed?
>>>>
>>>>
>>>> drizzo schrieb:
>>>>         
>>>>> but onClick event is triggered after the action tag or before?
>>>>>
>>>>> If is before, there is a way to excute a scritp after the action?
>>>>>
>>>>>
>>>>>
>>>>> Anton Gavazuk wrote:
>>>>>           
>>>>>> Of course use onClick attribute.
>>>>>>
>>>>>> 2009/3/26 drizzo <da...@accenture.com>
>>>>>>
>>>>>>             
>>>>>>> Hi everybody,
>>>>>>>
>>>>>>> i have this code:
>>>>>>>
>>>>>>> <tr:commandButton id="responseButton"
>>>>>>>                action="#{responseMgdBean.rResponse}"
>>>>>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>>>>>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>>>>>>>                text="#{responseButton.label}  "
>>>>>>>                rendered="#{responseButton.visible}"
>>>>>>>                shortDesc="#{responseButton.responseValue}"
>>>>>>> blocking="true">
>>>>>>>                <tr:setActionListener
>>>>>>> from="#{responseButton.responseValue}"
>>>>>>>                        to="#{responseMgdBean.responseValue}" />
>>>>>>>                <tr:setActionListener
>>>>>>>               
>>> from="#{responseButton.behaviour}"
>>>       
>>>>>>>                        to="#{responseMgdBean.behaviour}" />
>>>>>>>                <tr:setActionListener
>>>>>>>                       
>>>>>>>               
>>> from="#{dealCalculatorMgdBean.dealVariantIds}"
>>>       
>>>>>>>                        to="#{responseMgdBean.selectedVariantIds}" />
>>>>>>> </tr:commandButton>
>>>>>>>
>>>>>>> now I should run a js code before or after to execute the action.
>>>>>>> Which the best solution to do this?
>>>>>>> Is it possible use the onClick attribute?
>>>>>>>
>>>>>>> Please can you help me?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>>>>>>>               
>>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
>>>       
>>>>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>         
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22722528.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>>       
>>     
>
>   


Re: Javascript in button element

Posted by drizzo <da...@accenture.com>.

 No i have an iframe, when the button is clicked must be execute the method
specified in the action attribute, and after I should call a javascript
function (this is used to notify to a parent page the outcome)

Thanks 

D.


Rafa Pérez wrote:
> 
> Parent page? If you are inside a dialog, then you can define a
> returnListener method in the opener button to execute some logic when the
> dialog is closed.
> 
> HTH,
> 
> -- Rafa
> 
> On Thu, Mar 26, 2009 at 2:54 PM, drizzo <da...@accenture.com>
> wrote:
> 
>>
>> i should notify to parent page the result of the action. so i need wait
>> the
>> action is finished...
>>
>> i don't if is it possible
>>
>> Danilo
>>
>>
>> Simon Kitching wrote:
>> >
>> > For normal command-button usage, the current html page is submitted and
>> > *completely* replaced by a new HTML page. So it makes no sense to talk
>> > about running javascript "after" the action.
>> >
>> > Are you perhaps using these command-buttons within an AJAX pane, and
>> > want some javascript to execute after the AJAX request that the button
>> > triggers has completed?
>> >
>> >
>> > drizzo schrieb:
>> >>
>> >> but onClick event is triggered after the action tag or before?
>> >>
>> >> If is before, there is a way to excute a scritp after the action?
>> >>
>> >>
>> >>
>> >> Anton Gavazuk wrote:
>> >>> Of course use onClick attribute.
>> >>>
>> >>> 2009/3/26 drizzo <da...@accenture.com>
>> >>>
>> >>>> Hi everybody,
>> >>>>
>> >>>> i have this code:
>> >>>>
>> >>>> <tr:commandButton id="responseButton"
>> >>>>                action="#{responseMgdBean.rResponse}"
>> >>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>> >>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>> >>>>                text="#{responseButton.label}  "
>> >>>>                rendered="#{responseButton.visible}"
>> >>>>                shortDesc="#{responseButton.responseValue}"
>> >>>> blocking="true">
>> >>>>                <tr:setActionListener
>> >>>> from="#{responseButton.responseValue}"
>> >>>>                        to="#{responseMgdBean.responseValue}" />
>> >>>>                <tr:setActionListener
>> from="#{responseButton.behaviour}"
>> >>>>                        to="#{responseMgdBean.behaviour}" />
>> >>>>                <tr:setActionListener
>> >>>>                       
>> from="#{dealCalculatorMgdBean.dealVariantIds}"
>> >>>>                        to="#{responseMgdBean.selectedVariantIds}" />
>> >>>> </tr:commandButton>
>> >>>>
>> >>>> now I should run a js code before or after to execute the action.
>> >>>> Which the best solution to do this?
>> >>>> Is it possible use the onClick attribute?
>> >>>>
>> >>>> Please can you help me?
>> >>>>
>> >>>> Thanks
>> >>>>
>> >>>>
>> >>>> --
>> >>>> View this message in context:
>> >>>>
>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
>> >>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>>>
>> >>>>
>> >>>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22722528.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Javascript-in-button-element-tp22719877p22723296.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Javascript in button element

Posted by Rafa Pérez <ra...@gmail.com>.
Parent page? If you are inside a dialog, then you can define a
returnListener method in the opener button to execute some logic when the
dialog is closed.

HTH,

-- Rafa

On Thu, Mar 26, 2009 at 2:54 PM, drizzo <da...@accenture.com> wrote:

>
> i should notify to parent page the result of the action. so i need wait the
> action is finished...
>
> i don't if is it possible
>
> Danilo
>
>
> Simon Kitching wrote:
> >
> > For normal command-button usage, the current html page is submitted and
> > *completely* replaced by a new HTML page. So it makes no sense to talk
> > about running javascript "after" the action.
> >
> > Are you perhaps using these command-buttons within an AJAX pane, and
> > want some javascript to execute after the AJAX request that the button
> > triggers has completed?
> >
> >
> > drizzo schrieb:
> >>
> >> but onClick event is triggered after the action tag or before?
> >>
> >> If is before, there is a way to excute a scritp after the action?
> >>
> >>
> >>
> >> Anton Gavazuk wrote:
> >>> Of course use onClick attribute.
> >>>
> >>> 2009/3/26 drizzo <da...@accenture.com>
> >>>
> >>>> Hi everybody,
> >>>>
> >>>> i have this code:
> >>>>
> >>>> <tr:commandButton id="responseButton"
> >>>>                action="#{responseMgdBean.rResponse}"
> >>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
> >>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
> >>>>                text="#{responseButton.label}  "
> >>>>                rendered="#{responseButton.visible}"
> >>>>                shortDesc="#{responseButton.responseValue}"
> >>>> blocking="true">
> >>>>                <tr:setActionListener
> >>>> from="#{responseButton.responseValue}"
> >>>>                        to="#{responseMgdBean.responseValue}" />
> >>>>                <tr:setActionListener
> from="#{responseButton.behaviour}"
> >>>>                        to="#{responseMgdBean.behaviour}" />
> >>>>                <tr:setActionListener
> >>>>                        from="#{dealCalculatorMgdBean.dealVariantIds}"
> >>>>                        to="#{responseMgdBean.selectedVariantIds}" />
> >>>> </tr:commandButton>
> >>>>
> >>>> now I should run a js code before or after to execute the action.
> >>>> Which the best solution to do this?
> >>>> Is it possible use the onClick attribute?
> >>>>
> >>>> Please can you help me?
> >>>>
> >>>> Thanks
> >>>>
> >>>>
> >>>> --
> >>>> View this message in context:
> >>>>
> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
> >>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Javascript-in-button-element-tp22719877p22722528.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Javascript in button element

Posted by drizzo <da...@accenture.com>.
i should notify to parent page the result of the action. so i need wait the
action is finished... 

i don't if is it possible

Danilo 


Simon Kitching wrote:
> 
> For normal command-button usage, the current html page is submitted and
> *completely* replaced by a new HTML page. So it makes no sense to talk
> about running javascript "after" the action.
> 
> Are you perhaps using these command-buttons within an AJAX pane, and
> want some javascript to execute after the AJAX request that the button
> triggers has completed?
> 
> 
> drizzo schrieb:
>> 
>> but onClick event is triggered after the action tag or before?
>> 
>> If is before, there is a way to excute a scritp after the action?
>> 
>> 
>> 
>> Anton Gavazuk wrote:
>>> Of course use onClick attribute.
>>>
>>> 2009/3/26 drizzo <da...@accenture.com>
>>>
>>>> Hi everybody,
>>>>
>>>> i have this code:
>>>>
>>>> <tr:commandButton id="responseButton"
>>>>                action="#{responseMgdBean.rResponse}"
>>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>>>>                text="#{responseButton.label}  "
>>>>                rendered="#{responseButton.visible}"
>>>>                shortDesc="#{responseButton.responseValue}"
>>>> blocking="true">
>>>>                <tr:setActionListener
>>>> from="#{responseButton.responseValue}"
>>>>                        to="#{responseMgdBean.responseValue}" />
>>>>                <tr:setActionListener from="#{responseButton.behaviour}"
>>>>                        to="#{responseMgdBean.behaviour}" />
>>>>                <tr:setActionListener
>>>>                        from="#{dealCalculatorMgdBean.dealVariantIds}"
>>>>                        to="#{responseMgdBean.selectedVariantIds}" />
>>>> </tr:commandButton>
>>>>
>>>> now I should run a js code before or after to execute the action.
>>>> Which the best solution to do this?
>>>> Is it possible use the onClick attribute?
>>>>
>>>> Please can you help me?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Javascript-in-button-element-tp22719877p22722528.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Javascript in button element

Posted by Simon Kitching <sk...@apache.org>.
For normal command-button usage, the current html page is submitted and
*completely* replaced by a new HTML page. So it makes no sense to talk
about running javascript "after" the action.

Are you perhaps using these command-buttons within an AJAX pane, and
want some javascript to execute after the AJAX request that the button
triggers has completed?


drizzo schrieb:
> 
> but onClick event is triggered after the action tag or before?
> 
> If is before, there is a way to excute a scritp after the action?
> 
> 
> 
> Anton Gavazuk wrote:
>> Of course use onClick attribute.
>>
>> 2009/3/26 drizzo <da...@accenture.com>
>>
>>> Hi everybody,
>>>
>>> i have this code:
>>>
>>> <tr:commandButton id="responseButton"
>>>                action="#{responseMgdBean.rResponse}"
>>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>>>                text="#{responseButton.label}  "
>>>                rendered="#{responseButton.visible}"
>>>                shortDesc="#{responseButton.responseValue}"
>>> blocking="true">
>>>                <tr:setActionListener
>>> from="#{responseButton.responseValue}"
>>>                        to="#{responseMgdBean.responseValue}" />
>>>                <tr:setActionListener from="#{responseButton.behaviour}"
>>>                        to="#{responseMgdBean.behaviour}" />
>>>                <tr:setActionListener
>>>                        from="#{dealCalculatorMgdBean.dealVariantIds}"
>>>                        to="#{responseMgdBean.selectedVariantIds}" />
>>> </tr:commandButton>
>>>
>>> now I should run a js code before or after to execute the action.
>>> Which the best solution to do this?
>>> Is it possible use the onClick attribute?
>>>
>>> Please can you help me?
>>>
>>> Thanks
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>
>>>
>>
> 

Re: Javascript in button element

Posted by drizzo <da...@accenture.com>.

but onClick event is triggered after the action tag or before?

If is before, there is a way to excute a scritp after the action?



Anton Gavazuk wrote:
> 
> Of course use onClick attribute.
> 
> 2009/3/26 drizzo <da...@accenture.com>
> 
>>
>> Hi everybody,
>>
>> i have this code:
>>
>> <tr:commandButton id="responseButton"
>>                action="#{responseMgdBean.rResponse}"
>>                icon="/images/ico_#{responseButton.behaviour}.gif"
>>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>>                text="#{responseButton.label}  "
>>                rendered="#{responseButton.visible}"
>>                shortDesc="#{responseButton.responseValue}"
>> blocking="true">
>>                <tr:setActionListener
>> from="#{responseButton.responseValue}"
>>                        to="#{responseMgdBean.responseValue}" />
>>                <tr:setActionListener from="#{responseButton.behaviour}"
>>                        to="#{responseMgdBean.behaviour}" />
>>                <tr:setActionListener
>>                        from="#{dealCalculatorMgdBean.dealVariantIds}"
>>                        to="#{responseMgdBean.selectedVariantIds}" />
>> </tr:commandButton>
>>
>> now I should run a js code before or after to execute the action.
>> Which the best solution to do this?
>> Is it possible use the onClick attribute?
>>
>> Please can you help me?
>>
>> Thanks
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Javascript-in-button-element-tp22719877p22720303.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Javascript in button element

Posted by Anton Gavazuk <an...@gmail.com>.
Of course use onClick attribute.

2009/3/26 drizzo <da...@accenture.com>

>
> Hi everybody,
>
> i have this code:
>
> <tr:commandButton id="responseButton"
>                action="#{responseMgdBean.rResponse}"
>                icon="/images/ico_#{responseButton.behaviour}.gif"
>                binding="#{dealCalculatorMgdBean.buttonAccepted}"
>                text="#{responseButton.label}  "
>                rendered="#{responseButton.visible}"
>                shortDesc="#{responseButton.responseValue}" blocking="true">
>                <tr:setActionListener from="#{responseButton.responseValue}"
>                        to="#{responseMgdBean.responseValue}" />
>                <tr:setActionListener from="#{responseButton.behaviour}"
>                        to="#{responseMgdBean.behaviour}" />
>                <tr:setActionListener
>                        from="#{dealCalculatorMgdBean.dealVariantIds}"
>                        to="#{responseMgdBean.selectedVariantIds}" />
> </tr:commandButton>
>
> now I should run a js code before or after to execute the action.
> Which the best solution to do this?
> Is it possible use the onClick attribute?
>
> Please can you help me?
>
> Thanks
>
>
> --
> View this message in context:
> http://www.nabble.com/Javascript-in-button-element-tp22719877p22719877.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>