Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Alert Message onClick Client Script

salvadormarchan
Kilo Guru

good morning All,

I need some help on how to make an alert message when the user tried to click on a read-only textbox.

In the Client Script, I don't see onClick option. (note: this is follow up to this forum link correspondences: Textbox and Icon of glide date time Fields)

Thank you again!

Dor

1 ACCEPTED SOLUTION

twofirstnames
Kilo Expert

Hi Dor

Try the following:



function onLoad() {

$('change_request.start_date').observe('click', respondToClick);
$('change_request.end_date').observe('click', respondToClick);
$('change_request.work_start').observe('click', respondToClick);
$('change_request.work_end').observe('click', respondToClick);

function respondToClick(event) {
alert('Please use corresponding calendar icon when choosing dates.');
}

}


Cheers
Dale


View solution in original post

8 REPLIES 8

hi,



did you get a solution for this ?


twofirstnames
Kilo Expert

Hi Dor

Try the following:



function onLoad() {

$('change_request.start_date').observe('click', respondToClick);
$('change_request.end_date').observe('click', respondToClick);
$('change_request.work_start').observe('click', respondToClick);
$('change_request.work_end').observe('click', respondToClick);

function respondToClick(event) {
alert('Please use corresponding calendar icon when choosing dates.');
}

}


Cheers
Dale


Thank you again!!!! [another pointer for me to keep...]


Is there a similar function when clicking on a reference field ? Thanks