Hi,
I am trying to make a text-box used for passwords. To hide te text in “*” I am using hide_text but can I add a Checkbox to make this text visible for the user.
Thanks
Hi,
I am trying to make a text-box used for passwords. To hide te text in “*” I am using hide_text but can I add a Checkbox to make this text visible for the user.
Thanks
Yes. hide_text
is a boolean property of the TextBox
. You can link it directly to the state of the checkbox, no code required. See Data Bindings.
Thank you for your help.
What I have done:
checked hide_text in Text Box and add:
unchecked in Check Box and add:
in the Design page appears:
added the function:
def check_box_1_change(self, **event_args):
“”“This method is called when this checkbox is checked or unchecked”“”
self.refresh_data_bindings()
When I publish the app the output is:
The Check box is sort of checked and when write in text box the text is visible even if set it hide_text
When pressed the tick the text is hidden and work accordingly
What is my mistake when opening the App to display correctly the text box property as hidden and the check box unchecked?
Thank you
Make sure that self.item['N']
starts out with the value you want it to have. As a matter of timing, that usually means setting it in your Form
class’s __init__
or 'show` functions.
In particular:
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
That self.init_components
call will run the initial data bindings for your components. If you set self.item['N']
after that in the function or elsewhere, you’ll need to refresh data bindings again.
Hello @besarberdica1 .
Here’s a cloneable link to a small app demonstrating how to hide/show a password:
https://anvil.works/build#clone:ANFKOYVYZWZAHMER=QKKTKPXANR2HBG6YXYV42RIO