heikkilevanto / beertracker

Simple script to track the beers I drink
GNU General Public License v2.0
2 stars 1 forks source link

Extended input form #319

Closed heikkilevanto closed 1 month ago

heikkilevanto commented 1 month ago

With the new data types comes the need to input them. Many things are only needed for some data types, but a few are (almost?) universal:

So, keep the datetime and geo as a normally hidden section.

Add record type next to location. Depending on the record type selected, show one of the following sections:

Technically, all the inputs can be in the same form, as long as they are uniquely named. The record type decides which fields we end up using.

heikkilevanto commented 1 month ago

Done. Driven by the record definitions, or which we only have Beer and Old at the moment. More will come.

heikkilevanto commented 1 month ago

Another way would be to do the rendering on server-side. Changing the type would reload the page with an override for the type. That way, we could just do every field in order, and check against the record type (or override) if the field should be shown.

heikkilevanto commented 1 month ago

Doing it on server side seems to work better

Testing with a Night type that just has a comment and a text field for people. That brings up many warnings, which I am slowly killing.

heikkilevanto commented 1 month ago

Tried to disable the type pull-down, and enable when the user clicked Clr, but that somehow made it not to transmit the value on change.

Thinking about moving it into the hidden section, and just displaying the type in the main section.

heikkilevanto commented 1 month ago

Moved the type into the hidden section, works fine. I think the input form is now nearly complete. May have to add a few more fields if I define new record types, but that will be trivial.