mshaneef
mshaneef

Reputation: 1

Conditional Required field in Oracle ADF 12c

I have a form that requires multiple user inputs. One of them is a drop down list from which the User has to choose. Now I have to set the next input field as required depending on the options chosen in the first field.

For ex: There are 4 input options to be chosen for the first input field - A,B,C,D I want the next input field to become mandatory when the user chooses option A and D.

How do I build the expression for the required field in this case?

I have tried doing this but that doesn't work https://stackoverflow.com/a/48089828/15161963

Upvotes: 0

Views: 287

Answers (2)

Tung Vo
Tung Vo

Reputation: 2549

I think you can binding your dopdownlist to a bean.

binding=#{yourBean.firstDropdowList}

Create method isDisableInputField

Boolean isRequireYourInputField(){
 Boolean dropdownValue=firstDropdowList.getValue();
if("A".equals(dropdownValue) ||"D".equals(dropdownValue)) {
return true:
}
return false

}

In your af dropdown tag. Set

require=#{yourBean.isRequireYourInputField()}

Upvotes: 0

Ramesh Naamsaani
Ramesh Naamsaani

Reputation: 86

1). Assume that, the name of first field() is 'FirstField' and next input field id 'SecondField' .

2). Then on 'SecondField'component's Required property , write EL as below .

Required = #{bindings.FirstField.attributeValue eq 'A' || bindings.FirstField.attributeValue eq 'B'}

3). And ensure that , 'SecondField's partialTrigger property points to 'FirstField' component .

Upvotes: 1

Related Questions