-
I have a form view that I would like to be opened with all its fields locked / disabled / read only and instead of duplicating the form to have a second one to edit the fields, is it possible to use a button action to enable the fields, and disable them again on a "cancel edit" or "save" button? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @acseven Interesting use-case! Here's an approach you could take.
With the JavaScript: return {
itemName: true,
itemTags: true,
notes: true,
status: true,
purchaseDate: true,
purchasePrice: true
}
Do the same for the Cancel and Save buttons, however the boolean flag would be True in those cases. With the JavaScript binding: return {
...$("State.LockedFields"),
itemName: false
} Do the same for Cancel and Save, but flip the boolean to true. For the Save button add another action: And for the Cancel button, add another action as follows to reset the field value:
Also give the Buttons Container a fixed width so that the form fields don't move when switching between one Edit button, and two Cancel/Save buttons, say ResultApp Export |
Beta Was this translation helpful? Give feedback.
-
Thanks a bunch for the detailed instructions @melohagan! I've replicated it in a more general approach (a single Edit/Cancel/Save buttons group) and it seems to work well! Thank you again! |
Beta Was this translation helpful? Give feedback.
Hi @acseven
Interesting use-case! Here's an approach you could take.
Create an app with the sample data
Add a screen called
Inventory
. Add a table block for the Inventory tableDefine actions
for the On Row Click as follows:Create another screen with the route
/inventory/:id
. Add an Update form block for the Inventory table with the Row ID set to{{ URL.id }}
. De-select. any unwanted fields.In the On screen load actions of the
/inventory/:id
screen,Define actions
to set an initial lock state as follows:With the JavaScript:
This step will be a little ted…