how to disable input fields based on radio button selected
663270Nov 27 2008 — edited Nov 27 2008hi all,
I am using jdev 10g 10.1.3.3. I have a page with some radio buttons and input text fields. I want to disable certain input fields based on which radio button is selected.
I have 2 radio buttons Sale and Rent. If i select Sale, some text fields should be disabled and likewise for the Rent radio button.
Here is what I did:
1. In property inspector of the radio buttons
- autosubmit as true
- Id as selectFlatType
2. There is an input field named RentMonth which accepts a number value. This field should be disabled only if i select the Sale radio button. (there are some other fields associated with each of the radio buttons in same way.)
In property inspector of input text field RentMonth:
-Value as #{bindings.RentMonth.inputValue}
-Disabled set as #{backing_NewFlat.selectFlatType.value != "Rent"}
My problem now is that after step 2, this input field is automatically disabled here itself. When i run my page the field is already disabled before i select any radio button. There is no default selected value for the radio button.
I have a backing bean as follows:
public class NewFlat
{
private BindingContainer bindings;
private HtmlForm form1;
private CoreSelectOneRadio selectFlatType;
private CoreSelectItem selectItem_Rent;
private CoreSelectItem selectItem_Sale;
public NewFlat()
{
}
public void setForm1(HtmlForm form1) {
this.form1 = form1;
}
public HtmlForm getForm1() {
return form1;
}
public void setSelectFlatType(CoreSelectOneRadio selectFlatType) {
this.selectFlatType = selectFlatType;
}
public CoreSelectOneRadio getSelectFlatType() {
return selectFlatType;
}
public void setSelectItem_Rent(CoreSelectItem selectItem1) {
this.selectItem_Rent = selectItem1;
}
public CoreSelectItem getSelectItem_Rent() {
return selectItem_Rent;
}
public void setSelectItem_Sale(CoreSelectItem selectItem2) {
this.selectItem_Sale = selectItem2;
}
public CoreSelectItem getSelectItem_Sale() {
return selectItem_Sale;
}
Can anyone help how to do this?
Thanks
Preeti