Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

OnChange vs OnExit


Level 2

Good morning all,

I have this method:

var successFillColor = "204,255,255"; //Aqua

var reqFillColor = "255,255,0"; //Yellow

function validateACESID()


        var _Pattern = /^(\d{7})$/;


               var entered_text = VisitInformation.PatientInfo_subform.ACESID_TF.rawValue;











function unHighlight(fld)


               fld.fillColor = successFillColor;


function requiredHighlight(fld)


               fld.fillColor = reqFillColor;


When I call this method with "VisitInfo_Validation.validateACESID();" in OnExit it works perfectly, it highlights it yellow when the value is not 7 digits and then highlights it aqua when it is. Now, when I call this method in the OnChange it doesn't catch the true clause of the if statement, only the else.

If anyone can shed some light on this that would be very appreciated, thank you.


0 Replies


Level 5


When using the change event, try setting your value variable this way:

var entered_text = xfa.event.newText

This should grab the new value within the change event.

I believe rawValue is not updated until after the change event finishes


Level 2

I should have mentioned I'm doing this for HTML not PDF.

xfa.event.newText returns undefined unfortunitly.

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now