2

I'm trying to render the media manager field type in a custom form. The form is not loaded from the xml.

this code is causing an error:

$obj = new JFormFieldMedia();
$obj -> __set('name','icon_image');   
$obj -> renderField();

Please can you help me?

1

What you've been missing is adding your element to your form object, as shown below:

$media = new JFormFieldMedia();
$media->name = 'icon_image';
$media->label = 'Image';
$media->setForm($this->form);

Without binding it to a form, it cannot retrieve its underlying value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.