Thanks Everyone for your suggestions. I thought i give one more try before
looking at Trinidad etc.
Using Hidden Field i.e. passing hidden field value
When i access the input hidden value in other bean as follows it give a
value null
hiddenId = (String)FacesContext.getCurrentInstance().getExternalContext()
.getRequestParameterMap().get("hiddenInput");
System.out.println("In getHiddenInput="+hiddenId);
Here is snippet in xhtml file
<h:inputHidden name="hiddenInput" value="55" />
<h:commandButton id="findContact" value="Manage
Contacts"
immediate="true"
action="#{contactBean.getFormVariables}"
onclick
="createPopUp('contactLookup','find');"
image="/images/contacts.gif" border="0" alt="Click here to Manage Contacts"
>
Tomek Gołembiewski wrote:
>
> There is a esiest way to do that, if You use a trinidad just use a
> tr:commandButton
> or tr:commandLink set partialSubmit to true,look with the fire bug
> at the post parameters, put the same parameters into
> javascript method fte:
>
> var form = document.getElementById('your_form_id');
> TrPage.getInstance().sendPartialFormPost(form,{event: action, source:
> "your_component_id",partial: "true"},{});
>
> put this method into your own javascript method with anything You like
> - fte opening popup
> set Your new method into onClick or onMouseDown property of your
> tr:button and voila.
> Your method in backing bean is fired and Your javascript is runing too.
> If You put sendPartialFormPost fisrt the method binding is fired
> before openDialog js.
> To be 100% sure that js is fired always after the backing bean method
> U can attach a
> TrPage.getInstance().getRequestQueue().addStateChangeListener(myCallback);
> to check if method binding finished before runing other js.
>
> Regards Tomek
>
> On Jan 25, 2008 7:24 PM, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>>
>>
>> You might give shale remoting a look[1]. I have not tried to use it with
>> Trinidad but all I think you would need is the shale-core and
>> shale-remoting jars.
>>
>> [1] http://shale.apache.org/shale-remoting/index.html
>>
>> Gary
>>
>>
>> -------------- Original message --------------
>> From: bansi <[EMAIL PROTECTED]>
>>
>> >
>> > 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
>>
>> > > onmousedown="createPopUp('contactLookup','find')"
>> > onclick="return false" image="/images/contacts.gif" border="0"
>> alt="Click
>> > here to Manage Contacts"
>> > actionListener="#{contactBean.getFormVariables}">
>> >
>> >
>> >
>> >
>> >
>> > 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 th e
>> values
>>
>> > >> in
>> > >> Backing Bean
>> > >>
>> > >> Here is the snippet
>>
>> > >> > >> immediate="true"
>> > >> onmousedown="createPopUp('contactLookup','find')"
>> > >> onclick="return false" image="/images/contacts.gif" border="0"
>> > >> alt="Click here to Manage Contacts"
>> > >> actionListener="#{contactBean.getFormVariables}">
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>>
>> > >> Any pointers/suggestions will be highly appreciated
>> > >>
>> > >
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> > http://www.nabble.com/Is-it-possible-for-JSF-h%3AcommandButto n-to-e
>> xecute-Method
>> > Binding-and-JavaScript-tp15072394p15093039.html
>>
>> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >
>
>
--
View this message in context:
http://www.nabble.com/Is-it-possible-for-JSF-h%3AcommandButton-to-execute-MethodBinding-and-JavaScript-tp15072394p15115338.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.