Sunday, 26 July 2015

Reset Fields in a OAF Page

Whenever we click on Cancel button in the page, all the fields should be resetted to blank (NULL).

1) Enter the sample text in the page fields as below:



2) Click Cancel



3) Code to be written in the controller process form request method, since it is a post action once the page is loaded.

4) Sample code as below:

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
       
    // All the user actions should be handled in the processFormRequest method.
    if (pageContext.getParameter("Cancel")!=null)
    {
      OAMessageTextInputBean OA = (OAMessageTextInputBean)webBean.findChildRecursive               ("WelcomeTxt"); // WelcomeTxt is the internal field name
      OA.setValue(pageContext,"");
      String message="Clear the input";
      throw new OAException(message,OAException.INFORMATION);
     }    
       
  }


No comments:

Post a Comment