How to hide buttons on the form?

nthumma
Giga Guru

by default ServiceNow has two set of buttons one set on the top header of the form and one set is bottom of the form. i want to hide bottom set of buttons.

bottom button html code

<button onclick="return gsftSubmit(this);" style="white-space: nowrap" name="not_important" class="form_action_button   action_context btn btn-default" type="submit" id="sysverb_update" value="sysverb_update" gsft_id="42df02e20a0a0b340080e61b551f2909">Save &amp; Exit</button>

top header button html code

<button onclick="return gsftSubmit(this);" style="white-space: nowrap" name="not_important" type="submit" class="form_action_button header   action_context btn btn-default" id="sysverb_update" value="sysverb_update" gsft_id="42df02e20a0a0b340080e61b551f2909">Save &amp; Exit</button>

any thoughts?


CCing

Travis Toulson

Edwin Munoz

8 REPLIES 8

nthumma
Giga Guru

After little bit of research i came up with my own own method.( verified with fuji global scoped applications)



  setButton('form_action_button   action_context btn btn-default','none');



  function setButton(butname,style) {


  var refs = document.getElementsByTagName("button");


  if (refs) {


  for (var i=0; i < refs.length; i++) {


  var teststr = refs[i];


  if ($j(teststr).hasClass(butname)) {


  refs[i].style.display = style;


  }


  }


  }


  return true;


}



It will hide buttons on bottom of the form.



Thanks all for your time.


Close off the loop if the issue is resolved as it might help others to take notice of the solution. Thanks !


Very late but still for your information.


Check this post - https://community.servicenow.com/thread/194103


Mike Allens solution might work for you.


RM238
Tera Contributor

Hey @nthumma , thanks for sharing this. However, this didn't work. I copied exactly in onLoad script but bottom buttons still appear. Dumb question: is there anywhere I should change in the code? Advanced thanks!

Screenshot 2022-11-16 170406.png