-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Is it possible to create select
dynamically via API?
#211
Comments
Interestingly, I was thinking about this in the very same morning you opened the issue. Please let me know what you want to achieve and I will try to add an easy way to do that. Something like this maybe? await modalForm.openForm('form', {
overrides: {
fieldA: {
options: [
{ value: "pizza", label: "🍕 Pizza" },
{ value: "pasta", label: "🍝 Pasta" },
{ value: "burger", label: "🍔 Burger" },
]
}
}
}) |
In my workflow, when completing a task, I enter some data. I'm filling out several select. Moreover, one of the options is a list of blocks on the page, which I receive dynamically. This list varies accordingly from page to page. If this can be done using dataview, then you still need to pass the page as a parameter. I have now implemented via
I think this option will suit me too! But how to do it? |
I don't know where that data is coming from yet, but I will help you anyway 😄
Yeah, that was exactly my motivation to create this plugin, so you are in the right place
The open form method takes either a form name, or a form definition. If you build a form definition on the fly and then pass it as first argument, it will show you that form. await modalForm.openForm({
"title": "Example form",
"name": "example",
"fields": [
{
name: "favorite_meal",
label: "Favorite meal",
input: {
type: "select",
source: "fixed",
options: [
{ value: "pizza", label: "🍕 Pizza" },
{ value: "pasta", label: "🍝 Pasta" },
{ value: "burger", label: "🍔 Burger" },
],
},
isRequired: false
}
],
"version": "1"
}) |
select
dynamically via API?select
dynamically via API?
@theotheo can this be considered done? |
Yes, this issue can be closed. Thank you very much for your advice. Your code helped me to handle my daily tasks more conveniently. I would also like to mention that eventually, I went further and switched to using dataview-field. This is because the default select is not configurable.
|
Glad it is working for you. The select not being able to have a default
value is a known bug, I want to fix it
El dom, 4 feb 2024, 16:04, theotheo ***@***.***> escribió:
… Closed #211 <#211>
as completed.
—
Reply to this email directly, view it on GitHub
<#211 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARKJWLFYTNF5K5BAIVYTKLYR6PQNAVCNFSM6AAAAABB554TLSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGY4TKNZSGI3DQMY>
.
You are receiving this because you were assigned.Message ID:
***@***.***
com>
|
Hello, again!
As I understand it, the plugin has added the ability to create forms from the API. Please tell me if it is possible to set values for
select
.I mean something like this
The text was updated successfully, but these errors were encountered: