When the requirement needs the developer to implement a hide / show attribute conditionally, the task can be accomplished straightforward with an “auto-submit / partial trigger” strategy. However, when the case isthat the field you want to show / hide is required, things will definitely change.
Using as an example HR database in the new version of JDeveloper 12.c; we want to add an employee. If the new employee belongs to the Sales department, we need to specify a ‘Commission Percentage’ and it needs to be mandatory.
At this point, if you try to save the form, you will get a validation error as expected because the commission field is mandatory. However, If you got confused, and want to choose a different department;
This is not an expected behavior and the way to resolve it is implementing the approach programmatically. This is the structure of our page;
Once you have implemented this solution, you are going to be able to go back and forward; hiding and showing your required value in ADF. You just need to add the bindings of commisionField and the panelGroup to the bean.
Note: We used in this example ViewScope for the backing bean. You should reconsider this if you are planning to deploy you application in a clustered environment. We will post something about this in another post.