The event is: when the agent moves into and then out of the phone number text box, we want to alert the user to put something and move them back into the phone number box.
Process
# Take a text box on any form. Make sure you have edit permission to this form, i.e. there is a little pencil icon to the right of every question. [[File:Icon_Pencil.png]]
# Go to the very top of the editing page to find the field name. Usually in the format strCDA_X_field_Y_Z. For our example we will use the one displayed, i.e. strCDA_1170_field_0_3
[[File:JavaScript_onChangeDemo_QuestionEditTop.png]]
# Go down to the onChange box and enter the following
<source lang="javascript" line >
var setArray strCDA_1170_field_0_3 = functiondocument.getElementById(elems'strCDA_1170_field_0_3') {; thisif (strCDA_1170_field_0_3.length value == 0;''){ push strCDA_1170_field_0_3.applyfocus(this, elems); return this alert('Sorry but you must provide a phone number.');
}
</source>