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

[Feature request] Dataview Input add additional items #249

Closed kevinkickback closed 5 months ago

kevinkickback commented 5 months ago

I would like the ability to add/push additional entries to the array returned by the dataview input.

For example if I have a folder called "characters" with three notes inside: Person1, Person2, & Person3, I could use dv.pages('"characters"').file.name to return the three file names and somehow add a 4th option called "Everyone" to the list like:

danielo515 commented 5 months ago

This should be already possible. Will try to write an example as soon as I can

El sáb, 27 abr 2024, 1:04, kevinkickback @.***> escribió:

Assigned #249 https://github.com/danielo515/obsidian-modal-form/issues/249 to @danielo515 https://github.com/danielo515.

— Reply to this email directly, view it on GitHub https://github.com/danielo515/obsidian-modal-form/issues/249#event-12629132398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWPOWJPL6HBNNI3EJRDY7LMQRAVCNFSM6AAAAABG3RCOZSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSGYZDSMJTGIZTSOA . You are receiving this because you were assigned.Message ID: @.*** com>

danielo515 commented 5 months ago

Yes, it is possible and it is very simple. The dataview field it is just some expression that gets evaluated. It can be a single dataview command, or it can be more things, like concatenation of results like this:

['1','2', ...dv.pages('#programming').title]
Screenshot 2024-05-08 at 15 08 02

Take advantage of the preview to experiment a bit with what you will get in the input

Screenshot 2024-05-08 at 15 07 15
danielo515 commented 5 months ago

Added to advanced examples: https://danielorodriguez.com/obsidian-modal-form/advanced-examples/#adding-additional-items-to-a-dataview-input