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
204 stars 17 forks source link

Allow Default Value to pre-populate a Dataview field #144

Open buttonpushertv opened 10 months ago

buttonpushertv commented 10 months ago

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

In my situation, I am using a modal form to create child entities of a page; specifically, for TTRPGs, I have a Town page and then buttons that will call a QuickAdd/Templater command to create a new NPC or group based in that town. I have templater code that can pull the name of the town and feed it to the modal form so that the location field is pre-populated. It works great if that field is a "text" field. If that field is set to be a "Dataview" field, the default value is ignored.

Describe the solution you'd like

It would be nice if we could feed a default value to the "Dataview" field so that it could be pre-populated with a value.

Additional context

danielo515 commented 10 months ago

I agree that will be nice. The only thing is: do you expect the value to be validated? or just, if it is not available in the list of results, once you clear it you will not be able to select it again. Is that Ok?

buttonpushertv commented 10 months ago

I think it's ok to have it not be validated. The way I'm implementing it, it is already an existing page, so it can easily be recovered via the suggestions taken from the Dataview values.