How to stop onsubmit client script when click on the "Add to Cart" button

ramesh_r
Mega Sage

Hi All,

 

I have one onsubmit client script in the catalog item. the issue is the onsubmit client script is executing when click on the "Add to Cart" button.

 

I dont want to exicute the onsubmit client script when click on the  "Add to Cart" button

 

Please help me to achieve this.

 

function onSubmit() {
    alert("Test")
    return false;
}
3 REPLIES 3

rishabh katari1
Mega Guru

Hi @ramesh_r,

 

if you want to run it to stop on some condition, then:

function onSubmit(){

     if (condition){

        return false;
}else{

        return true;

}
}

or if you want to completely stop your client script then:

function onSubmit(){
        return false;
}

 

Let me know if you need any further help. 

Thanks,

Rishabh

Hi

 

I want to stop the script only when click on the "Add to cart" button not for the request or submit button

Then you need to configure the Widget "Add to Cart" according to your requirement.