Select options from simple array

webcrea 27 Jul, 2016
Hello,

I would want to fill a dropdown with a simple array (key and value are the same in dropdown)
The array content is different (depend on another var) and I can't use event because several dropdown are impacted by result and I would want only one array to manage several options list

How can i do, please to push in dropdow the simple array?

array like this
$options = Array( "var1", "var2"...);

and I would want
var1=var1
var2=var2
...etc
in dropdown

thanks
GreyHead 27 Jul, 2016
Hi Christophe,

I'm not clear - is this selection happening before the form loads - therefore using PHP; or after it has loaded depending on some selection by the user - therefore using JavaScript?

Bob
webcrea 27 Jul, 2016
Hello Bob,

It's a pulti-page form, in page 1 I select the program and page 7 I have two dropdowns with the content of the program.

I wanted to use a simple array in setup page 7 to fill 2 dropdowns...

now, I create a table with id,programme,libelle and I try to filter it with my value of program

debug
Array
(
    [option] => com_chronoforms5
    [chronoform] => Survey-Evaluation
    [event] => page7
    [anonymously] => 
    [program] => IWS2  // good this is my value for program
    [name] => 
    [company] => 
    [email] => 
    [online_prg] => Distance Learning
    [overall_satisfaction] => Good
    [next-btn] => Next
    [view] => form
    [Itemid] => 1618
    [lang] => en
    [list_regions] => Array
        (
        )

)
with in the db read conditions field
<?php return array('programme' =>$form->data[program] ); ?>


and this f$%* b*$รน^ of CF produces
[0] => SELECT `list_regions`.`libelle` AS `list_regions.libelle` FROM `skf0d_regions` AS `list_regions` WHERE `list_regions`.`programme` IS NULL ORDER BY `list_regions`.`libelle`
do you know why NULL value?

2 hours lost because this component is a bulls... to debug
GreyHead 27 Jul, 2016
Hi Christophe,

The only thing I can see that might cause it is the missing quotes in $form->data['program'] - Is that it?

Bob
webcrea 27 Jul, 2016
No I try it and several others
GreyHead 27 Jul, 2016
Hi Christophe,

By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.

Bob
This topic is locked and no more replies can be posted.