Forums

Dropdown inside repeater

ieraora 14 Dec, 2021
Hello. In actions I set an array..




and I want select only first line for dropdwon options, that is in a repeater



Why I've some options? Where I wrong?

This is row 3...




And this is row 4

Colnem 14 Dec, 2021
Hi

Your array is a simple array.

You do have an associative array, like this:
array(0=>'Citroën', 1=>'Peugeot', 2=>'Renault');
ieraora 14 Dec, 2021
HI Colnem, thank you for replay.

With this code

$cars=array
(
array(0=>'Citroën', 1=>'Peugeot', 2=>'Renault'),
array(0=>'Fiat', 1=>'Ford', 2=>'Ferrari')
);

return($cars);

I've same error

Colnem 14 Dec, 2021
One thing like this in php:

$varPhp= array(0=>'Citroën', 1=>'Peugeot', 2=>'Renault');

To return a php var in a form:
$this->set("ieraora", $varPhp);

So, in your Dropdown element, you can use:
{var:ieraora}
Colnem 14 Dec, 2021
Without php, you can do that...

1) In Load/Actions, create a Basic Databuilder
+Value, Type=Variable, Name=tmp, Value=Renault,Citroen, Peugeot
+Value, Type=Variable, Name=tmp, Value={var:split[]:tmp}

2) In Load/View,:
Create your dropdown element
Name=myvar, Options={var:tmp}
Create a submit button

3)in Submit action
create à Message
Content={data.pr:myvar}

You'll find 0 for Renault, 1 for Citroen, 2 for Peugeot
ieraora 14 Dec, 2021
Ok Colnem, the post #397607 not resolve the question.
The post #397608... refers to CF6??

I tried to post a easy question (because i think that is the block) , but really I need of an list of items from a table database, filtered by a value of every repeater.
I thought to print an array ( maybe using a loop) and select every row in a dropdown {var:ieraora.[n]} ??

I hope I was clear. I thank you if you can help me.
Colnem 15 Dec, 2021
OK

Sorry, but I don't understand very well: my english is not enough good.
You need to login to be able to post a reply.