Is a "Text Box Group" possible?

blissj 04 Mar, 2015
I have a number of items in an array and I would like to be able to create text boxes corresponding to those items. Basically just like using the dynamic data tab in the checkbox group but with text boxes. It doesn't even have to be a textbox really. A dropdown or even matrix of radio buttons could work if that was easier. I just need to be able to select the day of the week for each item in the list. The items change on a regular basis and there are a lot of them. There just isn't enough time to edit each element in the form individually. Any ideas would be appreciated. Thanks.
GreyHead 04 Mar, 2015
Hi blissj,

I think I would probably do by generating the whole thing from the data array in a Custom Element element. with an array of five (or seven) radio buttons for each item. That's neat and effective.

Bob
blissj 04 Mar, 2015
Is there an example somewhere of what the code for a custom element like that would look like?
GreyHead 13 Mar, 2015
Hi blissj,

Rough and ready code for a Custom Code element - probably needs debugging:
<?php
foreach ( $form->data['data'] as $k => $d ) {
 echo "<div>{$d}: <input type='radio' name='day[{$k}]' id='day_{$i}_a' />  <input type='radio' name='day[{$k}]' id='day_{$i}_b' /> . . . </div>";
}
?>

Bob
blissj 13 Mar, 2015
Thanks, I'll give it a try.
This topic is locked and no more replies can be posted.