I don't think this is a bug, but I also couldn't find any documentation on how to modify the results of what has been returned by views_embed_view (or if it is possible at all). I don't know how common this issue is (or if this this the best forum to submit this question).
The design goal is to have a sortable view of related content within my custom content type node edit form. So far I've created and embedded a view as a vertical tab in the content types node edit form using hook_form_alter() and views_embed_view(). The embedded view allowed users to reorder related entities via changing their weight via drop-down or dragging (using the weight module – NOT draggableviews).
The view also had a submit function associated with it, which saves the new the new weight settings. The view’s submit handlers were views_form_submit(), views_form_views_form_submit() and weight_views_submit().
At first glance this configuration worked, I could go to the vertical tab, view the view, drag to resort the list, and save the new sort. However the embedded view’s submit button now interferes with the edit form’s normal submit handler - node_form_submit().
I tried overriding the modified form’s submit function via $form[#submit], $form['actions']['#submit'], and $form['submit']['#submit'] to no avail. I also tried to access the embedded form's $form array to erase the view form's button and move it's handlers to the edit form's submit handler array but couldn't figure out how.
Q: Why does the embedded form submit handler override the host form's submit handler and how can I change this behavior?
AND/OR
Q: Is it better/possible to access and modify (delete) the embedded form's submit button and move it's submit handlers to the host form?
Seeking new suggestions, ideas or approaches.
Thanks in advance.
Chris
Comments
Comment #1
volker23 commentedSimilar problem. I experience the same behaviour with another approach:
I have a panel overriding the node/edit form of a custom content-type in one pane and a view in another pane, listing some nodes including 2 exposed filters to reduce the results of that list.
Both, the form and the view show up as i want, but if i use the exposed filters the node gets submitted instead of filtering the view.
Comment #2
cluther@Volker23 - I don't know if this will solve your issue, but I was able to resolve my problem by using the subform module (http://drupal.org/project/subform). This provided a way to successfully place a form within another form, and via its api provided me the option to submit the subform data separately or along with the host form's submit function. Sweet!
Comment #2.0
clutheredited
Comment #3
guerno commented@cluther, can you share how you did this? I am getting stuck add this. Trying to embed a draggable view in a node edit form. I checked out the subform module, but do not seem to make it.
Comment #4
mustanggb commentedClosing this as outdated to tidy up a bit around here. If you're still having problems with the latest release please create a new issue.