141
Views
6
Comments
Toggle feature
Application Type
Reactive

hello,

 have a question about how to enable and disable a Button using the toggle feature

This screen is  access admin will remain admin if you enable or disable any role with the toggle button
Now this is going on, if we disable any button, then it is done for all the roles, I have to disable or enable it with respect to the role
  I do not understand what will be the relation of the entity, how it will be saved in the database

Thanks for advance
regards Himanshu

2023-06-07 04-47-12
Ayush Tyagi

Hello @Himanshu dwivedi ,

can you please elaborate your question like what do you want to achieve?

UserImage.jpg
Himanshu dwivedi

 I do not understand that what will be the relation of the entity, how will it be saved in the database

UserImage.jpg
suyog gupta

hello,

Please follow this process....

Navigate to the screen where you want to enable and disable the button.

Find the button you want to enable/disable on the screen. It should be represented as a Button widget in the visual editor.

In the Properties pane of the Button widget, locate the "Toggle" property. Set the "Toggle" property to a Boolean variable in your application.

Create a Boolean variable in your application logic that will control the toggle state. You can define it directly in the screen action or in a separate action or local variable if needed.

Bind the Boolean variable to the "Toggle" property of the Button widget. You can do this by selecting the Button widget, opening the Properties pane, and finding the "Toggle" property. Use the binding editor to select the appropriate Boolean variable.

Now, when you want to enable or disable the button, you can modify the value of the Boolean variable in your application logic. When the Boolean variable is true, the button will be enabled, and when it's false, the button will be disabled.

To enable or disable the button programmatically, use an action or event handler in your application logic that modifies the value of the Boolean variable based on your desired conditions. For example, you can use a button click action to toggle the Boolean variable value.

UserImage.jpg
Aman Singh Rajput

Hello Himanshu,

I suggest you using an expression in the Enabled property of the button. Suppose the variable associated with toggle is IsToggleClicked and you want only admin to enable or disable the button. Then the expression would be something like this

If(IsAdmin & IsToggleClicked, True, False)

Hope this helped.


Regards,

Aman Singh Rajput

2024-09-12 02-43-38
Deepsagar Dubey

Hello @Himanshu dwivedi 

Create boolean type local variables for all available buttons and assign these local variables to each toggle / switch accordingly.



Suppose above toggle has variable TogglePopUp then assign the same variable to equivalent button visible property 



I hope it'll help you, 

Thanks
Deep

2024-09-27 19-05-42
Ravi Kumar Tasubilli

Hi Himanshu dwivedi,

Refer the user role documentation, every role has check, grant and revoke actions you can use it.

And you have to implement the logic to grant role or delete role to user.

thanks,

Ravi




Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.