So I'm trying to get my head around the creation of fields on the fly using
JForm::setField. But as usual there is no documentation explaining how to use this method only the very minimal API description.
I want to add a number of fields to a fieldset in a form on the fly. I've figured out that
$group is not the fieldset name so I don't understand what it is supposed to do...?
I've successfully added the field using the following:
$element = new SimpleXMLElement('<field name="onfly" type="text" label="onfly" description="onfly desc" class="inputbox" size="30" required="true" />'); $form->setField($element);
But I can't add it to the fieldset I want. I can add the
<fieldset> tags to
$element but that deletes any preexisting fields in that fieldset.
Also, since I will be using a loop to add multiple fields, should I be using
JForm::setFields instead? In which case I haven't a clue how to use that method!
Any help would be appreciated! Thanks