File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes how to get the value from the readonly field????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to get the value from the readonly field?????" Watch "how to get the value from the readonly field?????" New topic
Author

how to get the value from the readonly field?????

gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
Hi All,

I have a readonly field in JSF. in action class i want to get the value of that field.

How to get the readonly field value???

i am getting null if the field is readonly.
i am getting value if the field is not readonly.
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
hi all,

can anyone know how to get the value from readonly field in jsf???.

i am getting null.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Do you mean readonly as in readonly="true" or do you mean disabled components? Disabled components don't get their values submitted with the form.


GenRocket - Experts at Building Test Data
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
HI,

Thanks for reply.

Actually i have a date field and have a button.
when the user click the button it opens a calendar and set date in that field.

i want to set that date field as readonly and i need to get that date value when the user submit the form.

how to do this???
rahul sinha
Greenhorn

Joined: Feb 17, 2006
Posts: 7
Even I had the same problem in my previous project. But I want to ask why you want to make date field readonly? I feel one should also allow input field editable , so that user can enter date directly than doing clicking button always.

For your question according to my knowledge you cannot get value in BB for a ReadOnly field in JSF.

Please let me know if you get the solution.
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
Hi Rahul,

yes, you are correct , if the field is readonly then we cant get the value in backing bean of JSF.

so what i did was i used <f:convertDateTime> and i wrote validation method to check the format of the date in my backing bean.

so anyway user can enter the date , if he enter wrong date then it will throw conversion error, if he enters wrong format then my validator method will fire.

to display the message i am using <h:message>

thanks
Gopal
 
Don't get me started about those stupid light bulbs.
 
subject: how to get the value from the readonly field?????