Open buttonpushertv opened 11 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?
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.
@danielo515 Sorry to reopen this thread but is there a plan for this feature?
In my case, i try to replace this Templater Code by a Modal Form.
<%*
const toLowerCase = (string) => {
return string
.replace(/[\s_']+/g, "-")
.normalize("NFD")
.replace(/\p{Diacritic}/gu, "")
.toLocaleLowerCase();
};
const pageFolder = tp.file.folder();
const categoryName = tp.file.title;
const rootCategoryAliasTag = `#category/${toLowerCase(pageFolder)}`;
const categoryAliasTag = `${rootCategoryAliasTag}/${toLowerCase(categoryName)}`;
const parentCategoryTag = (
await tp.system.suggester(
(item) => item,
Object.keys(app.metadataCache.getTags())
.filter((x) => x.startsWith(`${rootCategoryAliasTag}`))
.sort((a, b) => a.localeCompare(b)),
true,
"Choose a parent category*"
)
)?.replace("#", "");
-%>
But I can't find a way to do it without pre-populate de Dataview field.
More specifically, would there be a way, without this feature, to retrieve these two instructions tp.file.folder()
and tp.file.title
in a dataview input form?
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