Monday, June 12, 2006

Make incorrectly populated fields blink on web

This tip shows how to make fields with incorrect values to blink with blue and red colors. The correctness of a field is verified against field's expected value.

blinking fields



click image to view in full size

Formula for the first computed field: @If(Field1="This field has correct value";"color:black";"color:blue; font-weight: bold")

Formula for the second computed field: @If(Field2="This field has correct value";"color:black";"color:blue; font-weight: bold")


Code on Form (remove space in tags):

< div id="field1" style="< Computed Value >">FIELD1< /div >
< div id="field2" style="< Computed Value >">FIELD2< /div >
< div id="field3" style="< Computed Value >">FIELD3< /div >

< script >
checkfield('field1');
checkfield('field2');
checkfield('field3');
< /script >



Code in JSHeader:

function blinkme(fldid) {
var fld=document.all[fldid];
if (fld.style.color=="red"){
fld.style.color="blue";
}else{
fld.style.color="red";
}
mytime=setTimeout("blinkme('"+fldid+"')",800);
}
function checkfield(fldid){
var fld=document.all[fldid];
if(fld.style.color=="blue"){
mytime=setTimeout("blinkme('"+fldid+"')",800);
}
}

No comments: