Hide/Show HTML button with Client Script

Erik29
Kilo Expert

Hi All, 

I'm having an issue and the suggestions on the portal doesn't get me any further. I have a order guide with some custom HTML widgets to interact with another application. Basically we have repository with all our personnel. Now is the use case that they can submit the order guide without interacting with the custom HTML wich creates the issue that the user record is incomplete and therefore the automated user creation will fail. 

To prevent this from happening i want to hide the next button on the order guide with a catalog client script

I have found that this is the HTML element for the button: 

<button id="submit" ng-hide="guide_step > 1" ng-disabled="submitted || data.sc_cat_item._mandatory.length > 0 || (totalIncluded <= 0 &amp;&amp; guide_step != 0)" name="submit" ng-click="goNext()" class="btn btn-primary padder-lg ng-binding" sn-focus="guide_step < 2" aria-hidden="false">Next</button>

 

Is there anyone who can help me with hiding this button onload? If i know how to hide it i certainly know how to enable it. Please help me:) 

 

1 ACCEPTED SOLUTION

Erik29
Kilo Expert

Unfortunately non of this works. I've fixed it with checking some conditions with a script include and an OnSubmit script to make sure that all the conditions are matched. 

View solution in original post

7 REPLIES 7

palanikumar
Mega Sage

if you want to permanently hide then ng-hide to true. So this will be always hidden

<button id="submit" ng-hide="true" ng-disabled="submitted || data.sc_cat_item._mandatory.length > 0 || (totalIncluded <= 0 &amp;&amp; guide_step != 0)" name="submit" ng-click="goNext()" class="btn btn-primary padder-lg ng-binding" sn-focus="guide_step < 2" aria-hidden="false">Next</button>

Thank you,
Palani

Thanks for your response, i don't want to hide it permanently. I want to hide it with an onload so i can set it visibel again with an onchange client script. 

In this case try this:

<button id="submit" ng-hide="data.guide_step > 1" ng-disabled="submitted || data.sc_cat_item._mandatory.length > 0 || (totalIncluded <= 0 &amp;&amp; guide_step != 0)" name="submit" ng-click="goNext()" class="btn btn-primary padder-lg ng-binding" sn-focus="guide_step < 2" aria-hidden="false">Next</button>

In client script set data.guided_step as 0 or 1. Change the value to 2 or above if you want to hide:

c.data_guide_step = 0;

Thank you,
Palani

Mohith Devatte
Tera Sage
Tera Sage

Hello @Erik ,

can you use this in catalog client script ?

document.getElementById('submit').style.display="none"

but DOM is not suggested in client scripts .

it might be asked to remove when there is a instance health scan .

but if you want to achieve it this is the way through client scripts

please mark my answer correct if it helps you