This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes trying to populate hidden field on my JSF form using jQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "trying to populate hidden field on my JSF form using jQuery" Watch "trying to populate hidden field on my JSF form using jQuery" New topic
Author

trying to populate hidden field on my JSF form using jQuery

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 375

I have some jQuery code whereby I am trying to set the SELECTED option in my dropdown list in a hidden field in the form. Per the code below, when I enter the value in the toAccountNumber field I run a query based on the first 2 characters entered in that field and then select the option that matches in my dropdown.

I want to populated the selected value in a hidden field before I disable the dropdown so that I can pass the hidden field value to my bean however, after the jQuery code completes I went to the view source and the hidden field value was not populated. I am assuming that I should see the value in the hidden field when the jQuery code completes, is that correct?

Any help/direction would be appreciated. Thank you.

BTW, I had used as an example a jQuery user's post on this URL to help me but I'm using blur and not click as the event to act on and it seems like it should work but it is not and I'm assuming I may have a syntax issue(?):

http://jsfiddle.net/charlietfl/5u3BZ/

Here is my jQuery code:



Here is my HTML for the hidden field on my JSF form:

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 375

I was finally able a value returned from the selectedFacilityCodeID in my dropdown. However, I'm still not able to populate the hidden field in my JSF form.

Here is the modified code but again cannot get the hidden field populated:



Hidden field in HTML:



Any suggestions? Surely this can't be this difficult. Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56150
    
  13

Moved to the JSF forum as the code examples have JSF tags.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 375

My problem was a syntax issue. Finally got it working. The correct syntax was:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trying to populate hidden field on my JSF form using jQuery
 
Similar Threads
Question on .submit and reloading form values AFTER the submit button is clicked
Question on jQuery ajax functionality & troubleshooting called bean in JSF page
Question on using jQuery's .attr AFTER form is submitted
Question on making a dropdown list read-only
Newbie question using jquery validator plugin on my JSF page