Sign in to Community
Sign in to view all badges
Is there a way to script to change all of the text in a textField back to text color black ("0,0,0") if a user has changed the text color using the Form Field Text Properties Bar? It looks like that is done on a separate layer?
I tried this and it does not work:
Subform1.UpperSection.font.fill.color.value = "0,0,0";
and I tried:
Subform1.UpperSection.font.color = "0,0,0";
var spans = util.xmlToSpans(this.value.exData["##xHTML"].saveXML());
for (var i = 0; i < spans.length; i++)
if (spans[i].textColor && !color.equal(spans[i].textColor, color.black))
spans[i].textColor = color.black;
var xHTML = util.spansToXML(spans);
this.value.exData.loadXML(xHTML, false, true);
Using util.xmlToSpans() will lose some other formatting, as it only supports a subset of what is available. If that is a problem then you can use E4X or some other XML handling code.
Thank you Bruce