Hello,anyone who could explain how to add a hidden field element to a JForm object in onXXXPrepareForm handler without creating and using a hidden.xml form field file? I seem not to get this managed on my own.Here is what i tried:$hidden = new SimpleXMLElement('<field type="hidden" name="test" value="test" default=""/>');// 1st try$form->setField($hidden, 'hidden', true);// dump form fieldsets and fields for testingforeach ($form->getFieldsets() as $group => $fieldset){echo '<pre>group: ' . print_r("{$group}: ", true) . '</pre>';$fields = $form->getFieldset($group);foreach ($fields as $field){echo '<pre>field: ' . print_r("{$field->name}: {$field->value}", true) . '</pre>';}}// 2nd try$hidden->setForm($form);// dump form fieldsets and fields for testingforeach ($form->getFieldsets() as $group => $fieldset){echo '<pre>group: ' . print_r("{$group}: ", true) . '</pre>';$fields = $form->getFieldset($group);foreach ($fields as $field){echo '<pre>field: ' . print_r("{$field->name}: {$field->value}", true) . '</pre>';}}What am i doin' wrong?--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send an email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/groups/opt_out.
Hello Mark,ye, i even tried this method without success.To answer my own question and providing one solution:I could manage to load the XML string after i prepended a form and fielset tag. So the properly working code in my case is:foreach (array('field1', 'field2', 'field3') as $fieldname){$form->setField(new SimpleXMLElement(''.'<form>'.'<fieldset name="hidden">'.'<field type="hidden" name="' . $fieldname . '" required="true" readonly="true" default="" />'.'</fieldset>'.'</form>'),null,true);}If anyone knows an easier solution or a has a suggestion to improve the above code, i was highly appreciated to know about it.