Validate dialog on OK button or Enter key
i have dialog bunch of checkboxes , ok , cancel buttons. when user clicks ok or presses enter, want validate other controls , keep dialog open if none of checkboxes checked. know how test checkboxes, not sure how event handler , keep dialog open. suggestions or pointers appreciated.
rick
here 1 way of doing it
var w = new window('dialog'); var chk1 = w.add('checkbox', undefined, 'check 1'); var chk2 = w.add('checkbox', undefined, 'check 2'); var btnok = w.add('button', undefined, 'ok'); var btncancel = w.add('button', undefined, 'cancel'); btnok.onclick = function () { //alert('click'); checked (); } btncancel.onclick = function () { //alert('cancel'); checked (); } w.show(); function checked () { if (chk1.value || chk2.value) alert('checked'); else alert('unchecked'); }
More discussions in InDesign Scripting
adobe
Comments
Post a Comment