The 'add' button works great! The edit button has a glitch that I found happening all the time, no matter if the node_reference is multivalue or not.
Basically, after adding an author, hitting the edit button to edit the author simply resubmits to the current page with the following error set:
Notice: Undefined index: nid in nodeconnect_add_edit_button_submit() (line 80 of /var/www/html/drupal/sites/all/modules/nodeconnect/nodeconnect.form.inc)
The line in question is 'nid' => $form_state['values'][$field][$language][$key]['nid'],
of
$data = array(
'form' => $form,
'form_state' => $form_state,
'dest' => $_GET['q'],
'field' => $field,
'key' => $key,
'add_child' => $form_state['clicked_button']['#add_child'],
'nid' => $form_state['values'][$field][$language][$key]['nid'],
);
in nodeconnect_add_edit_button_submit()
On inspecting $form_state['values'][$field], the data structure I see is:
Array
(
[und] => Array
(
[0] => Array
(
[edit_nodeconnect__field_author_0] => Edit Content
)
)
)
There is no 'nid' index in the array. This seems to be left over from some previous code and is preventing proper use of the functionality.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | nodeconnect-edit-nid-fix.patch | 1.07 KB | ifux |
| #4 | nodeconnect-edit-nid-fix.patch | 839 bytes | ifux |
| #2 | nodeconnect-edit-nid-fix.patch | 874 bytes | ifux |
Comments
Comment #1
cntlscrut commentedComment #2
ifux commentedhad the same problem and found out it's a '#limit_validation_errors' problem
patch bellow. hope could help you.
Merry Christmas to everyone! ;-)
Comment #3
berdirStill a tab instead of spaces here.
debug calls, should be removed
Comment #4
ifux commentedoops, changed it!
Comment #5
ifux commentedit's friday afternoon and soon christmas so my brain does not work that well ;-)
final patch (hope so!)
Comment #6
berdirLooks good and confirmed that it works.
Both uses of limit_validations_errors have been adjusted for consistency.
Disclaimer: I'm working together with ifux on this project.
Comment #7
cntlscrut commentedThanks guys!
I was trying some similar solutions, as well.
I'm going to review the patch and ready it for a commit.
Comment #8
oadaeh commentedI also confirm that the patch in comment #5 does fix the problem.
Thanks for saving me from having to figure out what the fix was. :^) I had already determined the cause when I found this issue.
@cntlscrut: the Status of "patch (to be ported)" is only for patches that need to go to a different major version, like from 7.x-1.x to 6.x-1.x. There is no other version to port this patch to, so it stays as "reviewed & tested by the community" until it is either committed or deemed as needing additional work. You are also not the person working on fixing the problem, so you should not assign the issue to yourself. Just FYIs for your future issue work. :^)
Comment #9
cntlscrut commentedPatch applied to branch 7.x-1.x
Comment #11
shiraz dindarHiya...
Hate to reopen an old issue but it turns out that the patch here unfixes the fix as provided in https://drupal.org/node/1101868. That is to say, we can again no longer use the nodeconnect add button on required fields.
I believe what is wanted is to go back to "'#limit_validation_errors' => array()" on the add button, and leave the "'#limit_validation_errors' => array(array($field_name))" on the edit button. This takes care of both this issue and the one above (which spawned this issue in the first place). Set as such, I have successfully locally tested both the edit button, and the add button on a required field.
I'd provide a patch except that I have other patches on my node_connect which would make my patch non-applicable here. But I do think it's as simple as above.
Hope this helps someone.
Shiraz
Comment #12
hefox commentedThere has been no changes.
I'm closing this and re-opening the other since the regression is of that bug.