Page 1 of 1

FormBuilder Using a Pulldown from UDT

Posted: Sat Jan 16, 2021 9:52 pm
by webform
Is there a clever way i can get a Pulldown in FormBuilder without manually have to create all the +100 Pulldown Options?

I need a Pulldown with a numeric range between 60 - 230 and it would be cumbersome to add Pulldown Options one by one by hand.

I've tried to make a numeric range pulldown as an UDT and create a "Module Interface Field" in FormBuilder and it works fine. But it should somehow tie in with the Formbuilder form and be recognised, so the selected valued get submitted.

So how do i get the FormID inserted in my Pulldown name in UDT?

Re: FormBuilder Using a Pulldown from UDT

Posted: Sat Jan 16, 2021 10:21 pm
by webform
I think i've figured it out;

I'm creating an User Defined Tag named height_dropdown :

Code: Select all

$form_id = isset($params['form_id']) ? $params['form_id'] : '';
$string = '<select class="form-control" name="' . $form_id . '" id="height_dropdown">' . PHP_EOL;
$string .= '<option selected="" value="">Choose one</option' . PHP_EOL;
for ($i = 60; $i <= 230; $i++) :
$string .= '<option value="';
$string .= $i;
$string .=  '">' . $i . ' cm</option>' . PHP_EOL;
endfor;

$string .= '</select>';

echo $string;
And then create a Module Interface Field in FormBuilder and insert my UDT "{height_dropdown form_id = $FBid}".

Only problem seems to be that field label, CSS Class and ID for the field is ignored.