Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Prepopulating is not compatible with checkboxes and radios.
Comment | File | Size | Author |
---|---|---|---|
#5 | multi_node_add-copy_values_radio_and_checkbox_fix_2.patch | 908 bytes | milton_segretti |
multi_node_add-copy_values_radio_and_checkbox_fix.patch | 798 bytes | Andreas Radloff |
Comments
Comment #1
Aron Novakthank you for the patch. it's committed
Comment #4
milton_segretti CreditAttribution: milton_segretti commentedHello, sorry to reopen this but I am having real difficulty getting this to work and was wondering if anybody else was having the same issue. I have tried rolling back the module to a version before the patch was submitted and applying it myself but I am still having no luck.
Pre-populate works fine with text boxes, text areas and select lists but no joy with check boxes and radio buttons.
Any thoughts?
Comment #5
milton_segretti CreditAttribution: milton_segretti commentedHello again, I had a go at fixing this for myself and have added a patch that seems to make it work for me. The issue I ran into was that the line:
var checked = $(this).is(':checked');
needed to be part of the IF statement above it as an AND. I also removed the "var checked ="
Next I changed the line:
$('#' + $(this).attr('id'), frames['node_' + i].document).prop('checked', checked);
to
$('#' + $(this).attr('id'), frames['node_' + i].document).attr('checked', true);
which made it work for the default version of jQuery shipped with Drupal 7 (version: 1.4.4, I think).
I don't know javascript but just following the logic and transferring what I know from my basic knowledge of php seemed to do the trick. Please feel free to point out if I have gone wrong somewhere.
Comment #6
Aron Novakcommitted, thanks, seems to be fine