File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes  Enable dynamic inputText    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark " Enable dynamic inputText    " Watch " Enable dynamic inputText    " New topic

Enable dynamic inputText

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 346

Hi every body ,

I have created 3 radiobuttons and 3 inputText fields in a panel grid , they are divided in two separate columns .All text fields are initially disabled.When user click one radio button (say radio1) the corresponding text field (say inputText1)
will get enabled .Again if radio2 is clicked then inputText2 will become enabled.

My problem is I am not getting the proper ID value of inputText & for that reason am not enable textfield.

Here is my jsf code :

Here is my backing bean code :

please help.

Aioria sun

Joined: Jun 03, 2009
Posts: 4
Hi, s begri
Since you using <h:selectitems /> tag for the options in radio button, the "dataMap" from your bakcing bean could be a single SelectItem instance or collection of SelectItem instance or an array of SelectItem instance or map whose entries represent SelectItem labels and values. I guess you only want to show the radio button without the label, so you can construct your "dataMap" like this:

the above codes give every option in radio a value, starting from 1.

then you can set up several boolean properties for your textfiled component, doing like

for the your getVal method, add the following codes:

by the way, the method you wrote setChieldInternationalTextField in your bean, i never seen it before, and i can't find it anywhere in JSF package. Could you tell me where it comes from.

Hope this help cheers!!
S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 346
Thank you dude , I solved the problem
I agree. Here's the link:
subject: Enable dynamic inputText
It's not a secret anymore!