Here I have a form , I need to submit the form when "enter" key Pressed, I have given the button type as "submit" , so that the form is submitted when enter pressed, at the same time ,i am calling a function with validation and confirmation, it not asking for the confirmation message and closed and submitted, My expected result is , when i press enter it should show the confirmation/Validation msg and I press enter again it should submit. Below is my code
            <form name="form1" id="form1" action="SizeMaster.php" enctype="multipart/form-data" method="post">
             <input type="text" class="form-control" name="txtSizeName"  value="" />
             <button type="submit" onClick="return fnSave()" class="btn btn-success waves-effect"><i class="material-icons">save</i><span>SAVE</span></button>
             </form>
              function fnSave(){
              if(form1.txtSizeName.value==""){
                alert("Please Enter size");
                return false;
              }
                  (!confirm("Are You Sure Want to confirm the Request?")){
              return false;
              }
              form1.action="SizeMaster.php?Mode=SAVE";
 }
 
     
     
     
    