JavaScript In-Question Validation

From All n One's bxp software Wixi

Revision as of 14:21, 29 May 2014 by Philip Lacey (talk | contribs) (Created page with "JavaScript validation can be applied to any field in a form not just on the outcomes. This is in field validation allows an agent to correct in real time the data whilst stil...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

JavaScript validation can be applied to any field in a form not just on the outcomes. This is in field validation allows an agent to correct in real time the data whilst still having the customer on the phone. In field validation is quite straight forward to set up but some considerations are needed.


The validation is added to the onFocus, onChange and onBlur events of the question. More information on this can be found at JavaScript_Field_Events


Lets start with a few simple examples. We have a text box which stores a mobile number. We do not want to let the agent move on until a phone number is in there. Why a phone number, well if you are in a call you really should have a number to call the customer back on, so phone number should be vital.


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.


var setArray = function(elems) {
    this.length = 0;
    push.apply(this, elems);
    return this;
}