Hide order now button on condition on Service Portal

nkumari
Tera Contributor

Have requirement to hide 'Order Now' button on service portal on condition.

Written on change client script which work on Native View but not on ServicePortal.

 

Please suggest how I can make to work on portal

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ch = g_form.getValue('action');
g_form.addInfoMessage(ch);
if(ch==''){
//$('sc_cat_item.no_order_now').hide();

var cart = document.getElementById('order_and_cart_v2');
cart.style.display='none';
}
else if(ch==''){

var carts = document.getElementById('order_and_cart_v2');
carts.style.display='';
}

}

1 ACCEPTED SOLUTION

Hi,

You can do it using catalog client script and below script

this.document.getElementsByClassName('btn btn-primary btn-block ng-binding ng-scope')[0].style.visibility= 'hidden';

View solution in original post

5 REPLIES 5

Kamil Smusz
Kilo Sage

Hi,

 

First thing is that you have the same conditions in if and else if.
Second thing is it not simpler to make this field mandatory so it prevent user from submission?

1. If and else condition is not same. It's just I did not shared it.

2. Its not similar to making field mandatory. Need to hide ' Order Now' Button if condition is true

Hi,

 

Can you instead write onSubmit Client Script and prevent submission?
Do you want to hide this button on Portal site ?

Yes, want to hide button on Portal site.