danielo515 / obsidian-modal-form

Define forms for filling data that you will be able to open from anywhere you can run JS
https://danielorodriguez.com/obsidian-modal-form/
MIT License
187 stars 15 forks source link

[Feature request] Conditional Rendering of Form Input #225

Closed aaachen closed 1 month ago

aaachen commented 6 months ago

My Usecase

I log the exercises I do and the associated information. Different exercises have different information that I need to input. For example, running requires input miles and time, push up requires input reps and sets, dumbbell curl requires reps, sets, and weight.

I want to customize my form in such a way that depending on the exercise picked, the form renders the correct inputs

Describe the solution you'd like

This would be an advanced option configurable for each form input (call it Conditional Render)

Conditional Render is a js function that given the state of the form object, return boolean for whether to render the input.

Work around I use quick add, the workaround here for that is to create separate forms and chain them (i.e. using the exercise example, first ask for the exercise, then the correct form to show)

This is less ideal as I prefer just one reactive form

danielo515 commented 6 months ago

This has been in my mind for some time already, and believe it or not, the implementation I was thinking was exactly the same. This is a duplicate of #71 , but because that one were 2 requests in one, and I already fulfilled one, I will favor this request as is better written and more focused.

danielo515 commented 1 month ago

This has been already implemented some time ago. Not sure why I forgot to close this issue.Hope you find it useful