This discussion is archived
5 Replies Latest reply: May 9, 2012 10:19 AM by Sudipto Desmukh RSS

Error Handling in Popup while Inserting record

918966 Newbie
Currently Being Moderated
I am using JDeveloper 11.1.1.6

My use case has a screen that displays data from a given table. On that screen I have an "add" button which when clicked gives the user a popup form in which they can add records. A copy of the popup is attached at the bottom. Here are a few notes on the fields in the popup:

Field1 - part of Primary Key. It is prepopulated for the user so it is read only
Field2 - part of Primary Key. User enters a value
Field3 - not part of Primary Key, but is a required value (not nullable)


The onAddRecordPopupFetchAction() in my backing bean performs a "CreateInsert".

In the popup if I enter a value for Field2 that is valid (doesn't cause a duplicate key) and populate Field3, upon clicking OK I successfully enter the addRecordDialogOKAction() method in my backing bean.

The problem I am having is if I enter a value for Field2 that is NOT* valid ( causes a duplicate key) and populate Field3, upon clicking OK I for some reason do not enter the addRecordDialogOKAction() method in my backing bean. Instead upon clicking OK, the app is determining that a duplicate key is causes and Field2 is highlighted with the error.




<af:popup binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.addPopup}"
id="addPopup" contentDelivery="lazyUncached"
popupFetchListener="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.onAddRecordPopupFetchAction}"
popupCanceledListener="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.onAddRecordPopupCancelAction}">
<af:dialog id="addDialog" closeIconVisible="true"
dialogListener="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.addRecordDialogOKAction}"
binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.addDialog}">
<af:panelHeader text="My Page"
binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.ph2}"
id="ph2">
<af:panelFormLayout binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.pfl1}"
id="pfl1">
<af:selectOneChoice value="#{bindings.Field1.inputValue}"
label="#{bindings.Field1.label}"
required="#{bindings.Field1.hints.mandatory}"
shortDesc="#{bindings.Field1.hints.tooltip}"
binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.soc2}"
id="soc2" readOnly="true">
<f:selectItems value="#{bindings.Field1.items}"
binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.si2}"
id="si2"/>
</af:selectOneChoice>
<af:inputText value="#{bindings.Field2.inputValue}"
label="#{bindings.Field2.hints.label}"
required="#{bindings.Field2.hints.mandatory}"
columns="#{bindings.Field2.hints.displayWidth}"
maximumLength="#{bindings.Field2.hints.precision}"
shortDesc="#{bindings.Field2.hints.tooltip}"
binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.it1}"
id="it1">
<f:validator binding="#{bindings.Field2.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Field2.format}"/>
</af:inputText>
<af:inputText value="#{bindings.Field3.inputValue}"
label="#{bindings.Field3.hints.label}"
required="#{bindings.Field3.hints.mandatory}"
columns="#{bindings.Field3.hints.displayWidth}"
maximumLength="#{bindings.Field3.hints.precision}"
shortDesc="#{bindings.Field3.hints.tooltip}"
binding="#{backingBeanScope.backing_ui_pages_Maintenance_viewMyPage.it2}"
id="it2">
<f:validator binding="#{bindings.Field3.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Field3.format}"/>
</af:inputText>
</af:panelFormLayout>
</af:panelHeader>
</af:dialog>
</af:popup>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points