I want to generate 10 controls by piklist by foreach. But the code is not working
$values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
foreach ($values as $value) {
piklist('field', array(
'type' => 'text',
//'field' => '_field',
'label' => 'field',
'value' => $value,
));
}
Above code just show only control, value is last of $values
. To achieve my purpose, there is only way, write 10 piklist()
manually
You're very close. Try this:
The 'value' parameter sets the default value for the field.
For a faster response try posting your questions on the Piklist Support Forum: piklist.com/support/