what is use of "addDecoration" in client script?when we are use?

SAIRAM14
Tera Contributor

find_real_file.png

3 REPLIES 3

Rajesh Mushke
Mega Sage
Mega Sage

Hey Sairam,



The GlideForm API provides methods to customize forms. GlideForm.js is the JavaScript class containing the methods. The global object g_form is used to access GlideForm methods. GlideForm methods are only used on the client.


These methods are used to make custom changes to the form view of records. All validation of examples was done using Client Scripts.


Some of these methods can also be used in other client scripts (such as Catalog Client Scripts or Wizard Client Scripts), but must first be tested to determine whether they will work as expected.



Note: The methods getControl(), getHelpTextControl(),getElement(), and getFormElement() are deprecated for mobile devices. For information on using GlideForm for mobile, see Mobile Client GlideForm (g_form) Scripting and Migration.


There is no constructor for the GlideForm class. Access GlideForm methods using the g_form global object.


GlideForm - addDecoration(String fieldName, String icon, String title)


Adds an icon on a field's label.


Adding the same item twice is prevented; however, you can add the same icon with a different title.
Note: This method is not supported by Service Catalog.


fieldNameStringThe field name.
iconStringThe font icon to show next to the field. Supported icons - icon-user, icon-user-group, icon-lightbulb, icon-home, icon-mobile, icon-comment, icon-mail, icon-locked, icon-database, icon-book, icon-drawer, icon-folder, icon-catalog, icon-tab, icon-cards, icon-tree-right, icon-tree, icon-book-open, icon-paperclip, icon-edit, icon-trash, icon-image, icon-search, icon-power, icon-cog, icon-star, icon-star-empty, icon-new-ticket, icon-dashboard, icon-cart-full, icon-view, icon-label, icon-filter, icon-calendar, icon-script, icon-add, icon-delete, icon-help, icon-info, icon-check-circle, icon-alert, icon-sort-ascending, icon-console, icon-list, icon-form, and icon-livefeed.
titleStringThe text title for the icon.
void
g_form.addDecoration('caller_id', 'icon-star', 'preferred member');

GlideForm - addDecoration(String fieldName, String icon, String title, String color)


Adds an icon on a field's label.


Adding the same item twice is prevented; however, you can add the same icon with a different title.
Note: This method is not supported by Service Catalog.


fieldNameStringThe field name.
iconStringThe font icon to show next to the field. Supported icons - icon-user, icon-user-group, icon-lightbulb, icon-home, icon-mobile, icon-comment, icon-mail, icon-locked, icon-database, icon-book, icon-drawer, icon-folder, icon-catalog, icon-tab, icon-cards, icon-tree-right, icon-tree, icon-book-open, icon-paperclip, icon-edit, icon-trash, icon-image, icon-search, icon-power, icon-cog, icon-star, icon-star-empty, icon-new-ticket, icon-dashboard, icon-cart-full, icon-view, icon-label, icon-filter, icon-calendar, icon-script, icon-add, icon-delete, icon-help, icon-info, icon-check-circle, icon-alert, icon-sort-ascending, icon-console, icon-list, icon-form, and icon-livefeed.
titleStringThe text title for the icon.
colorStringA CSS color.
void
g_form.addDecoration('caller_id', 'icon-star', 'Mark as Favorite', 'color-green');


Please refer:


Glide class overview


GlideForm - Client




Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

Hi Rajesh,



How to validate unique name in client script?



In my form "Name" field is there its string ,


i would like to apply the unique name validation how i will write code in client onSubmit?



Ex:


Raju is existing member in our list


i would like to create one more record with same name at that time form throws the error message    


Hello Rajesh,

Hover over help text for a field with the question mark inside a circle, and the question mark should be on the right side of a field, can you please help me with that. 

 

Thanks in Advance