Thanks Andrew/David
I am able to do both but it doesnt happen in sequence as  expected. 
As David correctly said "It's alwasy javascript onclick, followed by an http
method call"
But i wanna  do Method Binding first then Javascript OnClick.
Any pointers/suggestions will be highly appreciated
Here is the snippet which does both 
<h:commandButton id="findContact" value="Manage Contacts" immediate="true"
onmousedown="createPopUp('contactLookup','find')" 
onclick="return false" image="/images/contacts.gif" border="0" alt="Click
here to Manage Contacts"
actionListener="#{contactBean.getFormVariables}">
<f:attribute name="formName" value="deviceForm" />
<f:attribute name="fieldName" value="contact" />

</h:commandButton>

The reason i wanna do Method Binding first is i am passing parameters based
on which dataTable in popup xhtml should be rendered


David Delbecq-2 wrote:
> 
> Javascript = Client side
> ActionListeners / Actions = Server Side
> 
> So, answer is "no", you can't synchronize a javascript with a server 
> code. It's alwasy javascript onclick, followed by an http method call 
> (which will trigger all JSF stuffs)
> bansi a écrit :
>> I have a requirement where i wanna execute both Method Binding and
>> JavaScript
>> Code at the same time using JSF h:commandButton.
>>
>> The Javascript will open a popup while MethodBinding will set the values
>> in
>> Backing Bean
>>
>> Here is the snippet
>> <h:commandButton id="findContact" value="Manage Contacts"
>> immediate="true"
>>     onmousedown="createPopUp('contactLookup','find')" 
>>     onclick="return false" image="/images/contacts.gif" border="0"
>> alt="Click here to Manage Contacts"
>>     actionListener="#{contactBean.getFormVariables}">
>>       <f:attribute name="formName" value="deviceForm" />
>>      <f:attribute name="fieldName" value="contact" />
>>                                               
>>     </h:commandButton>
>>
>> Any pointers/suggestions will be highly appreciated
>>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-for-JSF-h%3AcommandButton-to-execute-MethodBinding-and-JavaScript-tp15072394p15093039.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to