Set the toggle state dynamically

Set the toggle state dynamically

Hi all,

I have a toggle button which show/hides a form. There is also an option that the form can be shown.hidden from a second button. When I click the second button in order to close the form I have to click twice the first button in order to open it. How can I set the toggle state of the first button in order to prevent this behavior?

Thanks in advance