New answers tagged

1

Another option could be to place the two versions of the field in separate .xml files in your /forms folder and then decide which one to load. If ($option == 1) { $form->loadFile('field_with_option'); } else ( $form->loadFile('field_without_option'); } In ../mycomponent/models/forms/field_with_option.xml you have <field name="field1" ...


1

So this is what I've done: protected function preprocessForm(JForm $form, $data, $group = '') { $app = JFactory::getApplication(); ... if ($app->isClient('site')) { // remove the field from the form. this is not realy needed, because if the third parameter on setField is true, the field gets replaced $form->...


1

The small problem with your question is that <option> is not a field attribute but an element in XML, so you cannot set or remove that using methods for field attributes. You can remove however these elements using PHP DOM extension's methods like: // $myradioForm = new Form('MyRadioForm'); // this is just a Joomla Form object. You use your own Form ...


Top 50 recent answers are included