Hi Bob,
I´m trying load dropdown options from the database. I want to use a phpscript to do that. So I added a "php-field" before the Display Section in the setup tab.
From the faq I used the example with a php-function to test:
function php1(){
$options = ["y" => "Yes", "n" => "No"];
return $options;
}
Is this script OK or can you just give me an exmple of the right function-syntax, this would help me.
In the designtab, do I need to call an action (events -> actions -> function) or is to write "{var:php1}" in the Options of the checkbox enough ?
Thank´s for your help
Pascal
I´m trying load dropdown options from the database. I want to use a phpscript to do that. So I added a "php-field" before the Display Section in the setup tab.
From the faq I used the example with a php-function to test:
function php1(){
$options = ["y" => "Yes", "n" => "No"];
return $options;
}
Is this script OK or can you just give me an exmple of the right function-syntax, this would help me.
In the designtab, do I need to call an action (events -> actions -> function) or is to write "{var:php1}" in the Options of the checkbox enough ?
Thank´s for your help
Pascal
Using {var} is enough.
That syntax should be fine. If not, do return json_encode($options); and then use {var.jsonde:phpaction}
That syntax should be fine. If not, do return json_encode($options); and then use {var.jsonde:phpaction}
Get rid of the function though
Hi healyhatman,
thank´a lot for your help. The first try with the function don´t work. So I´m trying with "json", that´s new for me, sorry.
my phpscript should be something like
$options = ["y" => "Yes", "n" => "No"];
json_encode($options);
and in the checkbox ???
{var.jsonde:phpaction}
what is "jsonde" and "phpaction", i have no clue.
Can you help me with an example or short explanation?
Thank´s in advance and Greetings from Germany
Pascal
thank´a lot for your help. The first try with the function don´t work. So I´m trying with "json", that´s new for me, sorry.
my phpscript should be something like
$options = ["y" => "Yes", "n" => "No"];
json_encode($options);
and in the checkbox ???
{var.jsonde:phpaction}
what is "jsonde" and "phpaction", i have no clue.
Can you help me with an example or short explanation?
Thank´s in advance and Greetings from Germany
Pascal
The PHP action should be in the same event as your display section.
And like I said it needs to RETURN json_encode(blahblah).
You might need to read the instructions and have a look at some demo forms.
And like I said it needs to RETURN json_encode(blahblah).
You might need to read the instructions and have a look at some demo forms.
Hi healyhatman,
believe me, before posting anything here, I spend always hours on trying and reading in the manual, faq and forum. I just didn´t find the soution for it. I also looked at the demo "Dynamic Dropdown", but I couldn´t find out, how to get the area "dynamic" in the setup.
Anyway, with your help, I found the solution for my problem.
Thank You very much.
Greetings from Germany
Pascal
believe me, before posting anything here, I spend always hours on trying and reading in the manual, faq and forum. I just didn´t find the soution for it. I also looked at the demo "Dynamic Dropdown", but I couldn´t find out, how to get the area "dynamic" in the setup.
Anyway, with your help, I found the solution for my problem.
Thank You very much.
Greetings from Germany
Pascal
This topic is locked and no more replies can be posted.
