So i have a case that i create a BPM Process and auto-generate the task form and then i have to validate user input at the task form. by default, the Submit form button is cannot do validation. so i have to change the autogenerated button with other button.
this link would redirect you to the original tutorial i follow to create new button to do the validation function.
http://niallcblogs.blogspot.com/2011/05/bpm-adf-form-streamlining-saveapprove.html
for the default submit button section, you could search for <af:commandToolbarButton> with <f:attribute name="DC_OPERATION_BINDING" value="bindings.SUBMIT"/> value.
i just comment that section using '<!-- -->' typical comment in html.
from the niall blogs, when you submit your form, it just return "closeTaskFlow" string to end the taskflow process, previously i try it in a pop up new window, the window won't close after i submit the form.
if you are having same case, add a javascript to close your pop up window.
FacesContext facesContext = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
service.addScript(facesContext, "window.opener = self;window.close();");
in your validation function, you can add this code to show a message pop up whether the form still has dirty data.
FacesContext facesContext = FacesContext.getCurrentInstance();
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, msg);
facesContext.addMessage(null, facesMsg);
at my case, i want to display a multiline error message in the pop up. you can do that with putting a <html> and <body> tag in the message. i got that from this tutorial.
http://mjabr.wordpress.com/2011/08/31/how-to-show-multi-lines-afmessage/
credit to original author :)







0 comments:
Post a Comment