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.
I tried different syntax, but it doesn't work.
How can I prepopulate the foolowing radio button.
Name of the field: field_test
Values: 0,1
I need a corect syntax of URL for this field. Many Thanks
Comments
Comment #1
naero CreditAttribution: naero commentedI can confirm that the following works in Drupal 6, but you'll need to try and test in D7:
I figured this out based on ianchan's reply here: from http://drupal.org/node/883980#comment-3419684
Essentially, the breakdown is:
https://example.com/node/add/story?edit[group_name][field_name][value][ABC]=ABC
Replace both "ABC" references with the field's form input value you to use to prepopulate. Took a bit of tinkering for me to figure, but it works. I'll close this issue, but please reopen if you're still having issues. Good luck!
Comment #2
s.Daniel CreditAttribution: s.Daniel commentedFor me it was:
&edit[field_output][und][2]=2
The html beeing:
Comment #3
sk33lz CreditAttribution: sk33lz commentedI can confirm that #1 syntax works with the latest Drupal 7 dev release for me as well.
Comment #4
TechNikh CreditAttribution: TechNikh commented#1 works with Drupal 7
Comment #5
bisonbleu CreditAttribution: bisonbleu commented#2 works for me.
See the Community Documentation page, under Taxonomy:
Where '92' is the term ID.
Comment #6
paultrotter50 CreditAttribution: paultrotter50 commentedI am still struggling with this. I have a pretty clean drupal7.42 sandbox installation that I'm testing this on. Using prepopulate 7x-2.1.
The radio button group I am trying to target is:
I have tried what I believe to be the formulas above and all sorts of variations on them. However I still haven't been able to get it to work. Could anyone suggest what I should be doing?
Some example of the things I've been trying are:
I have also added a radio button group called 'output' with 'Dashboard' and 'Report' as the options so that my code matches #2, but even after doing this the following link doesn't prepopulate the field:
<a href="https://localhost/drupal-sandbox/node/add/page?edit[field_output][und][2]=2">create new page radio2 no1</a>
Comment #7
paultrotter50 CreditAttribution: paultrotter50 commentedReopening as cannot get to work with the supplied code. Has something changed since the issue was opened?
Comment #8
bisonbleu CreditAttribution: bisonbleu commentedThis may be related to Container elements and their children cannot be prepopulated in the 7.x-2.1 security update release