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
175 stars 13 forks source link

[Feature request] Conditional with select #294

Closed Mara-Li closed 1 week ago

Mara-Li commented 1 week ago

Is your feature request related to a problem? Please describe.

I don't know why, but I can't make condition on select. It mustn't be so difficult, as you can already do it on toggle?

Describe the solution you'd like Support for select type in conditional.

Additional context /

danielo515 commented 1 week ago

I don't know why, but I can't make condition on select. It mustn't be so difficult, as you can already do it on toggle?

There is a reason: the v1 of the feature is meant to be small, so only a limit subset of all the fields can be used as condition.

The limitation only applies to using the field as the dependency of a condition. Are you seeing this problem when you want to make a select field conditional?

Mara-Li commented 1 week ago

Well, my problem is that I want to use it to make a conditional for it, not the invert XD typically, I have field for group A, group B etc… If group B selected ⇒ Display an option. I mean, we can make conditional on text, why don't use it the same (if contains, if equal…) for select, at minimum?

danielo515 commented 1 week ago

This is a very new feature (you opened the issue the same day I released it, so you are on the very edge 😂). I only added the things I was very sure about. With the select/dropdown I was not sure. Should I check just that the value selected meets any string? That it is one of the valid options? That it is specific numeric position (the first element, no matter the value, the last element, no matter the value). And because so many doubts, I decided to wait for feedback like yours. Will a basic 'string' comparision work for your case?

Mara-Li commented 1 week ago

Yeah, because I can just copy paste the value of the label in need to make the condition! And I know. Funny to see that I needed this plugin at the same time you release it.

I use it in my works to accelerate a template. Pretty useful in my case, I gain probably 1h/30min!

danielo515 commented 1 week ago

So, what should the value be compared against? the label? or the value? or both? And please, don't answer "it depends" 😂

danielo515 commented 1 week ago

Ok, it already works with value, so I will leave it like that

Mara-Li commented 1 week ago

More logical to works with value anyway !