Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force setter's call for disabled fields in JSF 2.0 [duplicate]

Tags:

jsf-2

In JSF disabled/readonly field's setters don't get called and hence the backing bean would never have the value of disabled field, be it check box or input text fields etc. What to do if I need value of disabled fields in fields mapped at bean? How can I force setters to get called so that it set the value back? Any suggestion/help will be highly appreciated.

like image 935
Monu Mishra Avatar asked Dec 07 '25 08:12

Monu Mishra


1 Answers

You could either disable the fields on client side with javascript or jQuery instead of using JSF's disabled="true" e.g. with jQuery:

See this post for details: How to disable an input with jQuery?

Or you could submit the disabled input field values as hidden fields together with your form

<h:inputHidden value="#{myBean.myValue}" />
like image 107
Matt Handy Avatar answered Dec 09 '25 21:12

Matt Handy