Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3740

Javascript event handlers question

$
0
0

I'm trying to use a javascript onchange() event handler on my Editor fields. Specifically, numeric fields so that I can check that the values meet certain criteria. The field definition looks like this:

{label: 'W2', name: 'W2_Amount', id: 'W2_Amount', type: 'text', attr:{onchange:'myChange(this)',classname:'numericField2',type:'number',maxlength:13, min:'0', max:'99999999', step:'0.01'} }

The onchange() event handler executes when the field value changes, which is what I want, but it also executes when the Editor page first displays for every field that has an onchange() event handler, which is what I don't want. My guess is that the initial page load's values go from uninitialized to a value, triggering the event handler for each field, when the page loads. Is there a way to bypass the initial triggering on a page load? Or should I be handling event handlers a different way?


Viewing all articles
Browse latest Browse all 3740

Trending Articles