Error Message Going Behind Popup in ADF
Scenario:
When you have a Popup to edit the employee record. Now you have putted some validation like if salary is less than 1000 then you want to show some error message to user from your bean.
The code of the validation on button click that I have written is as follows:
public void validateSalary(ActionEvent actionEvent) {
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = bindings.findIteratorBinding("EmployeesVO1Iterator");
if(((oracle.jbo.domain.Number)iter.getCurrentRow().getAttribute("Salary")).intValue()<1000){
FacesContext ctx = FacesContext.getCurrentInstance();
FacesMessage fm =
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Salary should not be less than 1000.", "");
ctx.addMessage(ctx.getViewRoot().getId(), fm);
}
}
Problem:
The error message may come behind your edit popup as shown below in the image.
Solution:
Put the PartialSubmit="true" fro the button "Save Employees" as follows:
<af:commandButton text="Save Employee" id="cb6"
actionListener="#{backingBeanScope.TestBean.validateSalary}"
partialSubmit="true"/>
After this run your page and try, you can see the error message is coming on top of the edit popup.
That's all :) Happy Coding.
When you have a Popup to edit the employee record. Now you have putted some validation like if salary is less than 1000 then you want to show some error message to user from your bean.
The code of the validation on button click that I have written is as follows:
public void validateSalary(ActionEvent actionEvent) {
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = bindings.findIteratorBinding("EmployeesVO1Iterator");
if(((oracle.jbo.domain.Number)iter.getCurrentRow().getAttribute("Salary")).intValue()<1000){
FacesContext ctx = FacesContext.getCurrentInstance();
FacesMessage fm =
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Salary should not be less than 1000.", "");
ctx.addMessage(ctx.getViewRoot().getId(), fm);
}
}
Problem:
The error message may come behind your edit popup as shown below in the image.
Solution:
Put the PartialSubmit="true" fro the button "Save Employees" as follows:
<af:commandButton text="Save Employee" id="cb6"
actionListener="#{backingBeanScope.TestBean.validateSalary}"
partialSubmit="true"/>
After this run your page and try, you can see the error message is coming on top of the edit popup.
That's all :) Happy Coding.
Thanks.... nice one
ReplyDeleteThanks... This helped me :)
ReplyDeleteThank you
ReplyDeleteThank you very much Kunal, this realy helped me!
ReplyDeleteThank you!!
ReplyDeleteHey..Thanks a lot for this.
ReplyDelete