Thursday 31 May 2012

how to use javascript on submitbutton in OAF page and to stop submit of the form before fill it completely


 public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
   // get the handle of submitButton  and attach the javascirpt functin to it using setOnclick method of OASubmitButtonBean as shown below;
OASubmitButtonBean  sbButton = (OASubmitButtonBean)webBean.findIndexedChildRecursive("SubEmpReq");
sbButton.setOnClick("javascript:var Val=document.getElementById('EmpPositionName').value; if(Val==''){  alert('Fill PostionName'); document.getElementById('EmpPositionName').focus();return (false);}return (true);");
   

  }

2 comments: