Prepopulating is not compatible with checkboxes and radios.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Aron Novak’s picture

Status: Needs review » Fixed

thank you for the patch. it's committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 38c2caf on 7.x-1.x, 8.x-1.x authored by Andreas Radloff, committed by Aron Novak:
    #2087413 Support checkboxes and radios when prepopulating based on first
    
milton_segretti’s picture

Issue summary: View changes

Hello, 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?

milton_segretti’s picture

Assigned: Andreas Radloff » milton_segretti
Status: Closed (fixed) » Active
FileSize
908 bytes

Hello 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.

Aron Novak’s picture

Status: Active » Fixed

committed, thanks, seems to be fine

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.