This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSF and the fly likes How to call JSF action from jQuery ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to call JSF action from jQuery ?" Watch "How to call JSF action from jQuery ?" New topic
Author

How to call JSF action from jQuery ?

Manish Suriya
Greenhorn

Joined: Jan 17, 2010
Posts: 2
Dear experts,

I have a button in my JSF Page. I want to display a pop up on OnClick event of this. To display a Pop up i have used jQuery.

The javascript is like this...


and the CommandButton is like this...



On Click of "button_1" my javascript got called and Pop up got displayed. The Pop will ask from the user to eneter some value. Now i want to call 'savedetails' method of WelcomeUserBean after popup and the value which user has entered in pop up should be passed to the method.

I tried calling another jsf function (say xyz()) in abc() but the function is not getting called.

i have also used this code. Its workd finr in pure JS but not in jQuery

[code]document.getElementById["UserWelcomeForm:button_1"].click();code]

I have googled a lot and find that we can call using Ajax. but i am not sure how to use it.
Can anyone help me out.

Thanks in Advance !!


Thanks & Regards
Manish
Manish Suriya
Greenhorn

Joined: Jan 17, 2010
Posts: 2
I got the solution.. the problem was i was using </h:commandButton> inside <f:verbatim> .
So i did something like this and its working now....


and in JS



Question is: How should i pass the button id (item.buttonid) of button i clicked upon to my savedetails function.

Thanks in Advance !!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to call JSF action from jQuery ?
 
Similar Threads
Popup dialog at mouse position... works in IE, not Firefox
Assinging JavaScript variable as a textbox id
Creating a masked popup in JavaScript
Hiding a popup span with onblur
Spring model attribute is not populating values