Catalog Item

Narmadha PR
Tera Contributor

Hi,

I'm trying to add a placeholder in the catalog variable. I used the below mentioned onload client script, but the placeholder is not working on the service portal. Please help me on this requirement.

 

function onLoad() {
var field = g_form.getElement('originalnumber');
if (field) {
field.setAttribute('placeholder', 'Enter your text here');
}
}

 

3 ACCEPTED SOLUTIONS

J Siva
Tera Sage

Hi @Narmadha PR 
Just use the "Example text" field on the catalog variable form to add placeholder message.

JSiva_0-1749889840371.png
JSiva_1-1749889860597.png

Hope this helps.
Regards,
Siva

 

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@Narmadha PR 

there is no method to make it work for portal.

you can try to use DOM manipulation but that's not recommended.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@Narmadha PR Nope. It's not possible. However, create two separate fields for those two scenarios and Show/hide the variable as required.

View solution in original post

4 REPLIES 4

J Siva
Tera Sage

Hi @Narmadha PR 
Just use the "Example text" field on the catalog variable form to add placeholder message.

JSiva_0-1749889840371.png
JSiva_1-1749889860597.png

Hope this helps.
Regards,
Siva

 

Hi @J Siva,

Thank you for your response!

I want to change the placeholder value according to different conditions. Example: If I select "yes" in a field then the placeholder should be "www.abc.com", if "no" then the placeholder should be "www.xyz.com". So I need to handle it in scripting. Is there any possible ways?

 

@Narmadha PR Nope. It's not possible. However, create two separate fields for those two scenarios and Show/hide the variable as required.

Ankur Bawiskar
Tera Patron
Tera Patron

@Narmadha PR 

there is no method to make it work for portal.

you can try to use DOM manipulation but that's not recommended.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader