Best setup to build a form?

Just wondering how other users have built their forms or if anyone has any tips.

I have currently built a form to create new things and a different form to view, delete and edit existing things.

I’m just wondering if I can save a lot of work by creating a single form for the full CRUD, creating, viewing, editing and deleting things? Or is it going to get too complicated. I wanted to save time every time I make changes to the form I don’t have to do it in 2 places.

Any opinions out there on how you built your forms, any pros and cons.

Thanks

Depending how complex your form is really. You could target specific form fields (show/hide) when certain conditions are true/false. I personally like to target most things when custom states are available.

@morewebs my forms are pretty complex and already show hide elements depending on selections and so on, thats why a made the decision to use two forms, one for creating and the other for reading, updating or deleting.

Just wondering if any Bubbler is doing it all on one form.

I use one form. Firstly for the reason you already mentioned that it is easier to maintain. But more importantly, for the UX. Keeping 2 forms identical would take a lot of unnecessary effort.

@SerPounce how do you control when the form should be empty if its creating a new thing or showing data if its editing an existing thing? Do you use conditions to show or hide “initial content” or “default value” of a field?

I have no issue with the UX part because I’m a perfectionist :slight_smile: (I’m a UX product designer myself) but maintaining these forms is a nightmare.

Just wondering what a condition might look like…

It should be quite straightforward using a text custom state on the page called something like “formMode”, where formMode values could be add, edit, ,read etc.

Default value could be any of them and then on page load, have a few actions with “only when” something like only when this user doesn’t have he record, set custom state to add etc.

1 Like