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

Enable/Disable button based on text field change

SGOLI_20
Level 2
Level 2

Hi,

I'm trying to enable/disable the "Submit PMT ACN" button based on the user input. I've put code in change event of the field to activate the button but the the downside is that when user is typing in data into field, its loosing focus.

I tried to put in exit event but, the event is firing only when the user clicks somewhere outside of the field.

Disabled Button

Capture1.JPG

Enabled Button

Capture2.JPG

Can someone please help with some ideas to implement this?

Many thanks,
Sandeep

1 Reply
Anonymous
Not applicable

In the change event of the text field, assuming your button is named Button1 and var checkTest value is password:

var startVal = "";

var checkThis = "";

var checkTest = "password";

if (this.rawValue != null) {startVal = this.rawValue;}

checkThis = startVal + xfa.event.newText;

if (checkThis === checkTest || xfa.event.newText === checkTest) {

          xfa.host.messageBox("got");

          Button1.presence = "hidden";

}

else {

          Button1.presence = "visible";

}

this works by me (tested).

Hope it helps.