Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By HeshanKaru1994
#825099
Code: Select all
form = getFormById("637207031573dceaf797e28050874261");
form.setOnSubmit(function(){
 if  ($("#invoiceAmount").getValue() <= 500 || $("#invoiceAmount").getValue() == "") {
    alert("The Invoice Amount is too high or is empty.");
    return false; //stop submit
  }
});
This code will stop submitting a form.Assume you have 3 different validating methods.
return False on each of the following methods will still submit the form
User avatar
By amosbatto
#825101
You have to do it this way:
Code: Select all
form = $("#637207031573dceaf797e28050874261");
form.setOnSubmit( function() {
 var invAmt = parseInt( $("#invoiceAmount").getValue() );
 if  ( invAmt <= 500 || $("#invoiceAmount").getValue() == "") {
    alert("The Invoice Amount is too high or is empty.");
    return false; //stop submit
  }
});
By HeshanKaru1994
#825132
Code: Select all
form = $("#637207031573dceaf797e28050874261");
form.setOnSubmit( function() {
 functionA();
functionB();
});

function functionA(){
    if(){
   return false;
}else{
    }
}

function functionB(){
  if(){
   return false;
}else{
    }
}

I was wondering a situation like this.When I try I found that all the method implementations should be inside the same place rather than in different places?
User avatar
By amosbatto
#825136
Do it this way:
Code: Select all
form = $("#637207031573dceaf797e28050874261");
form.setOnSubmit( function() {
  if (functionA() === false || functionB() === false) {
     return false;
  } 
} 
function functionA(){
    if(){
   return false;
}else{
    }
}

function functionB(){
  if(){
   return false;
}else{
    }
}
PS: If you are going to post code, put it inside code tags. It is the "</>" icon in the post editor.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]