1

On a node/add page I have a node reference. The widget type is "checkboxes" and I'm using the "View used to select the nodes" feature to show up to 5 checkboxes on the node/add page.

I would like to prepopulate a checkbox with the prepopulate module.

The checkboxes use this HTML name value:

name="field_tribe_content[und][18824]"

Usually prepopulate works by adding this to the url, but it doesn't work in this case.

?edit[field_tribe_content][und]=18824

There is some info in the issue queue and I have also tried

?edit[field_tribe_content][0][nid]=18824
?edit[field_tribe_content][0][nid][nid]=18824
?edit[field_tribe_content][nid][nid]=18824

How can I get it to work or what else could I do to preopulate those checkboxes?

  • I never used prepopulate module so i'm not sur about my answer. But i often passed a value on my form to my node reference on a module like this: $form['field_node_reference']["und"][0]['nid'] = array( "#type" => 'value', "#value" => $product->nid, ); Maybe try this path ?edit[field_tribe_content]["und"][0]['nid'] to prepopulate your checkbox – Epok Sep 22 '12 at 23:39
  • thanks, that didn't do it either. I think because of the checkbox widget the prepopulate module would have to add a checked="checked" to the HTML and not just modify the value. I don't think it can do that ... – uwe Sep 23 '12 at 1:07
1

Take a look here:

Prepopulate checkbox [#checked]

I have also been searching for a solution on how to do this.

  • that patch worked for me – uwe Dec 14 '12 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.