Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Hide "Submit" button in a Catalog Item

Federico Fiume
Tera Contributor

Hi,

I need to hide the "Submit" button in our Service Portal, only for one Catalog Item.

Do you suggest using a Catalog Client Script or to change the whole SC Catalog Item widget script?

Thanks,
Federico

1 ACCEPTED SOLUTION

Nitin_NOW
Tera Guru

If you don't want show Submit button and if catalog item is just for informational purpose without any fields/values in it, I recommend you to create a Content Item instead of Catalog item. Content Item does not contain these buttons and can be used in place of catalog item.



Define a content item



Please hit correct based on impact of response.



Thanks!


View solution in original post

5 REPLIES 5

Allen Andreas
Tera Patron

Hi,



Clone widget:



Server Script:


  1. var validatedItem = new GlideappCatalogItem.get(data.sys_id);  
  2. if (!validatedItem.canView())  
  3.   return;  
  4.  
  5. data.sc_cat_item = $sp.getCatalogItem(data.sys_id);  
  6. //prepped data for the controller here:  
  7. data.sc_cat_item.no_show_attach = validatedItem.gr.u_no_attach == true;  
  8. data.sc_cat_item.no_submit_btn = validatedItem.gr.u_no_submit_button == true;  


Client:


  1. c.showAddCartBtn = function() {  
  2.   return c.options.show_add_cart_button &&  
  3.   c.data.sc_cat_item.sys_class_name !== "sc_cat_item_producer" &&  
  4.   !c.data.sc_cat_item.no_cart;  
  5. };  
  6. //added 2 functions here:  
  7. c.allowAttach = function() {  
  8.   return !c.data.sc_cat_item.no_show_attach;  
  9. };  
  10. c.showSubmitBtn = function() {  
  11.   return !c.data.sc_cat_item.no_submit_btn;  
  12. };  

HTML:


  1. <!-- added a new ng-if to this line: -->  
  2. <button ng-if="c.showSubmitBtn()" name="submit" ng-disabled="submitted" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>  
  3. <button ng-if="c.showAddCartBtn()" name="submit" ng-disabled="submitted" ng-click="triggerAddToCart()" class="btn btn-default">${Add to Cart}</button>  
  4. <span ng-if="submitting" style="padding-left:4px">${Submitting...}</span>  
  5. <!-- added to the ng-if that was on this line: -->  
  6. <label ng-if="!submitted && c.allowAttach()" style="float:right;font-weight:normal;cursor:pointer;"><sp-attachment-button></sp-attachment-button><span style="padding-left:4px;">${Add attachments}</span></label>  
  7. <div ng-if="hasMandatory(mandatory)" class="alert alert-info" style="margin-top: .5em">  
  8. <span ng-if="hasMandatory(mandatory)">${Required information} </span>  
  9. <span ng-repeat="f in mandatory" class="label label-danger" style="margin-right: .5em; display: inline-block;">{{::f.label}}</span>  
  10. </div>  



Source found here:


Hide submit button on load of catalog item in Service Portal



Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Nitin_NOW
Tera Guru

If you don't want show Submit button and if catalog item is just for informational purpose without any fields/values in it, I recommend you to create a Content Item instead of Catalog item. Content Item does not contain these buttons and can be used in place of catalog item.



Define a content item



Please hit correct based on impact of response.



Thanks!


Thanks Nitin, I didn't know about Content Item.