Search Results

Wednesday, November 26, 2008

Hide a mandatory field

How to hide a mandatory field in OAF Page

If the business wants to hide a field in the seeded page, you can do it by personalizing the page and set Rendered property to false.
But this solution will not help you if the field is marked as mandatory by the seeded page.

The reasons are Mandatory Validations are usually done at the EO level. Hence even if you hide the mandatory field, the validation would still happen at the server. If the column has not null constraint in the table, it will throw a database error.

Can I extend the VO or EO and remove the mandatory property?
No, you cannot change the mandatory property through extension.

How to fix this?
You can fix this by setting a default value for the mandatory field.

Should I extend the VO/EO and set the default value?
Do not extend the VO/EO for the defaulting logic. Because extensions are applied at the site level and the Oracle seeded pages share the same VO/EO all over the Applications.

Where to default the value?

Extend the controller and set the value in the processRequest(){} method. This is the safest way to default the value to the mandatory field.

After defaulting the mandatory variable, personalize the page and set the rendered property to false.

Article By:
Prasanna Jayaraman

Please post your Ideas and Comments
Post a Comment