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

setting attributes of text/input fields at runtime

Not applicable
I am currently defaulting some text to an input field at the docReady event by checking to see if the InpField1.rawValue = NULL.

What I would like to do now is either turn the background fill color to gray or to make the field read only until the user clicks on it to enter their text.

Using the Click event, I'd like to revert the color to normal or set the mode to input when they click to enter their text.

How can I set the attribute of the input field? I see setAttribute but i'm not sure which attributes can be set if any, at runtime.

thanks alot.
1 Reply
Level 10
Level 10

I assume InpField1.rawValue = NULL is pseudo-code.

Try the following in the initialize event of InpField1:

To set the color to grey

InpField1.ui.oneOfChild.border.fill.color.value = "190,190,190";

To set the access to read only

InpField1.access = "readOnly";

To reset access to user entered optional change the access property to "open" on the enter event.

Many examples can be found here