Learn about step to validate one to many record when submit.

Procedure

  1. From ONEWEB workspace, open java file name "com.manual.doc.order.java.OrderRequestRequesterInsertMode" and override method "validateResult()" with coding below.


@Override

       public boolean validateResult() {

               // TODO Auto-generated method stub

               logger.debug("=========Validate require at least 1 order request item=======");

               boolean result = true;

               String nextEntity = (String)request.getParameter("nextEntity");

               logger.debug("##### nextEntity #####"+nextEntity);

               

               if(nextEntity == null || "".equals(nextEntity)) {

                       String entityID = (String)getRequest().getSession().getAttribute("entityID");

                       EntityFormHandler FormEntity = (EntityFormHandler)request.getSession().getAttribute(entityID + "_session");

                       Vector vError = FormEntity.getFormErrors();

               

                       MasterFormHandler FormMaster = (MasterFormHandler)request.getSession().getAttribute("MD11784591_session");

                       Vector vFormMaster = FormMaster.getStoreActionList();

                       logger.debug("##### vFormMaster #####"+vFormMaster);

               

                       if (vFormMaster.size() == 0) {

                               vError.add("Please add order item at least 1 item");

                               result = false;

                       }

               }

               return result;

       }


  1. Replace "MD11784591_session" with module id of module "Order Request Item" in entity "Doc Order Request - Requester" (concatenate module id with "_session")
    • Click edit at module "Order Request Item" and find module id at property name "Module ID"


  1. From ONEWEB workspace, export EafMasterEar.ear and deploy update to server. The class name "com.manual.doc.order.java.OrderRequestRequesterInsertMode" will update to server.


  1. Test by log in to FrontWeb.
    • Click menu SETTING > Refresh Cache to update new configuration at App Designer to server.
    • Click menu DOC Order Request and click CREATE. Submit without adding oder request item.