aspose file tools*
The moose likes JSF and the fly likes DropDown that triggers a postback Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "DropDown that triggers a postback" Watch "DropDown that triggers a postback" New topic
Author

DropDown that triggers a postback

Peter Irmstadt
Greenhorn

Joined: Mar 01, 2009
Posts: 24
Hi!

I am using JSF with Facelets and JBoss Seam but am quite new to this technology.

I want to create an AJAXless application with a dropdown list that triggers a postback after the value has changed. I tried to google around but didn't find anything suitable.

I currently created a dropdown list that is populated with a list of entity beans:




(1)
How can I change that drop down list to update automatically if an entry has been chosen?

(2)
The list is populated correctly with a list of users from the db. As value the correct db id is used.

This is the manager bean with its interface





Selection no domain results in the correct "none" log, but if I choose a domain, I get a "validation error: invalid value" (translated from German error message)

Do you know where there might be a mistake?

Thank you in advance!
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Use Javascript to submit the form during the onchange event.
To the point, add onchange="this.form.submit();" to the component.

By the way: why "ajaxless"? What's the point?
Peter Irmstadt
Greenhorn

Joined: Mar 01, 2009
Posts: 24
Bauke Scholtz wrote:Use Javascript to submit the form during the onchange event.
To the point, add onchange="this.form.submit();" to the component.


Sounds good, thank you!

Bauke Scholtz wrote:By the way: why "ajaxless"? What's the point?


Well, two things: First I just started using Seam, JSF and Java EE. Originally I worked with ASP.Net - I want to start with the basics and will definitely work with AJAX later.
The second thing is that some things I played around with didn't work the way I wanted it. The web application I am working on will be mainly used by IE6 users that can't handle any error message. Maybe a prejudice, but I thought that I stick to the "basics" as long as I exactly know what I am doing ;)


By the way, do you know a solution to my second answer? I tried several things but don't know what to try else...
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You will get this error during the apply request values phase when the selected item turns out not to be part of the collection/array of select items. So basically you need to make sure that the collection/array of select items is the same during the next request as it was during the initial request.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DropDown that triggers a postback
 
Similar Threads
This has to be the strangest thing...
dropdown problem
Selecting option in second selectOneMenu not setting property value
populating SelectOneMenu using ArrayList
problem with <h:selectOneMenu component --- javax.el.PropertyNotFoundException: