File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
gopal kishan
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic