File Upload not working after moving form field

70 Views Asked by At

I have a large form with a image upload field working ok.

Field is defined in model as:

$this->add('filestore/Field_Image','thumbnail_id');

Then I created two tabs inside form:

$tabs=$form->add('Tabs');
$main=$tabs->addTab('General');
$design=$tabs->addTab('Design');

And moved image field to design tab:

$design->add($form->getElement('thumbnail_id'));

Now I can't upload files. When I try I get the following javascript error Error: cannot call methods on atk4_form prior to initialization; attempted to call method 'submitPlain

Is there any other way to move the field or have upload working again after moving it?

1

There are 1 best solutions below

0
On

I was trying to use the same method ($design->add($form->getElement('my_element'));) to move a slider into another place on the page. That didn't work - I think it was because the slider input field is not placed on the page the same way as other input fields.

So I tried with the jQuery appendTo-method (I found the hint in a comment from romanish in a documentation page). That worked. But then I experienced the same problem as you - and in the end I gave up and solved the problem by editing the slider-class page.

So I can't help you, sorry, but I guess this points out that there is a general problem related to getting input from moved form elements.