Can you condense my 4 lines of code into 1 line?
i'm writing passive validation script validates fields enter & exit events , changes background colour , border colour of field's value:
this.ui.oneofchild.border.fill.color.value = "255,216,229";
this.ui.oneofchild.border.getelement("edge", 0).color.value = "244,138,159";
this.ui.oneofchild.border.getelement("edge", 1).color.value = "244,138,159";
this.ui.oneofchild.border.getelement("edge", 2).color.value = "244,138,159";
this.ui.oneofchild.border.getelement("edge", 3).color.value = "244,138,159";
this working fine question how can condense these 4 lines 1 line of code?
this.ui.oneofchild.border.getelement("edge", 0).color.value = "244,138,159";
this.ui.oneofchild.border.getelement("edge", 1).color.value = "244,138,159";
this.ui.oneofchild.border.getelement("edge", 2).color.value = "244,138,159";
this.ui.oneofchild.border.getelement("edge", 3).color.value = "244,138,159";
i'm using on every single field, , it's starting make code swell.
thanks!
to answer question, here's way:
var i=5;while(--i) this.ui.oneofchild.border.getelement("edge", i).color.value = "244,138,159";
however if you're using in every single field, should either isolate code function inside script objects, , call 'this' parameter:
myscriptobject.changecolor(this);
or, if you're using lc designer es, place code in object further hierarchy , activate "enable event propagation" (check box next "language: javascript" "run at: client")
More discussions in LiveCycle Designer
adobe
Comments
Post a Comment