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

Enter text, Clicks a check box

Avatar

Level 1

I am trying to figure out a script that does the following:  If you enter text into a text field, a check will appear in a check box.  Anyone know how to do this?

3 Replies

Avatar

Level 2

hi Jess2080,

place a textfield and checkbox into the layout from the library,

use the below script for a textfield

Event : exit    Language : Javascript

if

(this.rawValue.length >

0 )

{

subform1.CheckBox1.rawValue

=

"1";

}

else

{

subform1.CheckBox1.rawValue

=

"0";

please find the sample attachment.

Thanks,

Madhu.

Avatar

Level 1

Madhu,

I found your answer to be very helpful.  After playing around with it, I found this to work:

Event : exit    Language : Javascript

if

(this.rawValue.length >

0 )

CheckBox1.rawValue

=

"1";

else

CheckBox1.rawValue

=

"0";

However, the only problem I am now finding is that I enter text, and the check in the check box appears.  Then, if I remove the text, the check box still stays.  Any ideas about this?

Thanks,
Jess

Avatar

Level 2

hi Jess2080,

after you remove the text, just come out of that field then you will see the uncheck of checkbox.

this is because we have written the script in Exit event of the Textfield.

Thanks,

Madhu.