• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem to submit the form when populate the <h:selectOneMenu> using javascript

 
sa sam
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am populating <h:selectOneMenu> by using javascript. but when i click on submit button it gives me error -

INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=fileConfig:select1[severity=(ERROR 2), summary=(fileConfig:select1: Validation Error: Value is not valid), detail=(fileConfig:select1: Validation Error: Value is not valid)]


when i submit the form selecting value "Select Type" (which id declared in .jspx) it get submitted successfully.
.jspx -



script file -



i don't want to use backing bean to populate the select box, so please help me to correct the code.
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF is predicated on the idea that data shall be validated before it can be accepted. The standard validation for selectOneMenu is to see if the returned value is one of the items in the control's SelectItems list. If not, validation will fail and the update will be rejected. The SelectItems list is on the server. It will not be aware of any client-side mods made to the UI element, and really shouldn't be, since a hacker could circumvent edits and possibly exploit the webapp.

If you want a client-side generated list, you should not use the JSF selectOneMenu, you should simply use the HTML SELECT element. However, if you do so, the results will not bind to a backing bean without some serious kludging. If you just want a dynamic list, it's better to use AJAX and a SelectItems list.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!