0

I have a ADF jsff page which contains a af:inlineFrame this frame invokes slickGrid, on save i validate the grid cells and error message is displayed by showing an alert message. Once i click on ok, i expect the grid to stay as it is but the grid gets loaded again. After displaying the alert message i have tried window.frames[0].stop(); but this didnt help

JSFF:

<af:inlineFrame id="slickFrame" 
                                source="/js/views/tarAutomation.html"                                
                                sizing="preferred" shortDesc="Slick Grid">
                    <af:serverListener type="onLoadEvt" method="#{pageFlowScope.myBean.initializeGrid}" />
                    <af:clientListener method="triggerOnLoad" type="inlineFrameLoad"/>

on click of Save

function save() {
// Parse through the dirtied cells
  for(d in dirtyCells)
   {   
     var dirtiedRow = dirtyCells[d].row;
     failures = //Gets the failure array
        if(failures.length>0){
          alert("Mandatory fields are not entered");                               
          grid.gotoCell(dirtyCells[d].row, dirtyCells[d].cell); 
        // This is to set the focus on the errored cells
          window.frames[0].stop();
       }
        else{
            //Continue with the save operation
        }

Please let me know how to stop the grid from getting loaded. I want the loading to stop so that the user selected options are seen as errored.

jmargolisvt
  • 5,722
  • 4
  • 29
  • 46

2 Answers2

0

It's likely this is just an HTML issue, nothing to do with the grid. It's likely that the save button submits the form. You need to return false from the javascript event to prevent the default action (the submission).

Have a look here: JavaScript code to stop form submission

<form name="myForm" onsubmit="return validateMyForm();">

<script type="text/javascript">
function validateMyForm()
{
  if(check if your conditions are not satisfying)
  { 
    alert("validation failed false");
    returnToPreviousPage();
    return false;
  }

  alert("validations passed");
  return true;
}
</script>
Ben McIntyre
  • 1,972
  • 17
  • 28
0

I found a way to stop the grid from loading In the Jsff javascript function add event parameter At the end of this method add event.cancel() which would cancel the new events from being propagated Further details are here https://docs.oracle.com/cd/E16764_01/web.1111/b31973/af_event.htm