Trying to create a ViewObject (using JDeveloper 11.1.2.3) that can be dropped on a page to create a form such as:
The form parameters must be submitted to a custom reporting framework. In the ViewObject, certain attributes must be linked to List-of-Value selectors, or have its data type picked up from the ViewObject automatically. The developer should be able to drag-and-drop the ViewObject to create a functional form.
This would allow the form to perform input validation using the ViewObject, and allow List-of-Value objects to be used as well.
There is no entity that backs the ViewObject. There is no SQL that drives the ViewObject. The ViewObject doesn't really need programmatic access, nor is it a static list. It is simply meant to be a container for parameters that can be subjected to validation rules. When a developer drops such a ViewObject on the form, it creates a form with no visible input fields:
The code behind the scenes resembles:
<af:inputText value="#{bindings.ManagementCentre.inputValue}"
label="#{bindings.ManagementCentre.hints.label}"
required="#{bindings.ManagementCentre.hints.mandatory}"
columns="#{bindings.ManagementCentre.hints.displayWidth}"
maximumLength="#{bindings.ManagementCentre.hints.precision}"
shortDesc="#{bindings.ManagementCentre.hints.tooltip}"
id="report_P_MANAGEMENT_CENTRE">
</af:inputText>
<af:inputText value="#{bindings.ClinicServiceCentreName.inputValue}"
label="#{bindings.ClinicServiceCentreName.hints.label}"
required="#{bindings.ClinicServiceCentreName.hints.mandatory}"
columns="#{bindings.ClinicServiceCentreName.hints.displayWidth}"
maximumLength="#{bindings.ClinicServiceCentreName.hints.precision}"
shortDesc="#{bindings.ClinicServiceCentreName.hints.tooltip}"
id="report_P_CLINIC_SERVICE_CENTRE">
<f:validator binding="#{bindings.ClinicServiceCentreName.validator}"/>
</af:inputText>
The code for the submit button runs a managed bean to extract the form parameters and pass them into the report (via a report framework):
<af:commandButton text="Run Report" id="submitReport">
<af:fileDownloadActionListener method="#{reportBean.run}" />
</af:commandButton>
How do you create such a ViewObject that can perform validation but does not need to be backed by a data source?
You have to:
Create the view object as follows:
Configure the validation rules as follows:
At this point a view object has been configured and the List of Values tab can be used to reference query-based LOVs.
Configure the application module as follows:
Note: If the view object is not visible, restart JDeveloper.
Create a web page for the form as follows:
The web page is created.
The attributes for the view object cannot be changed unless there is a "row" created for the view object instance. Creating this in-memory row must happen before the page content is displayed. Accomplish this as follows:
Validation is applied and data-driven LOVs can be used.
Remove the "Create" button.