Is prepopulate meant to work with CCK select boxes. I have HTML like:

BPMBREselect>

I tried to prepop with:

http://drupal.mysite.com/?q=node/add/project&edit[field_project_type][ke...

but it doesn't work. Is there another syntax I need to try?

Comments

ChrisBryant’s picture

I'm trying to do the same thing here with CCK content types and no luck. Is it not supported at this time?
Chris

ChrisBryant’s picture

After reading through this page/comment (http://drupal.org/node/81945#comment-137233) I was able to figure how to get it to work with CCK field types.

Here is an example with snippets of the page source:

Issue Type:

<select name="field_issue_type[key]" class="form-select required" id="edit-field-issue-type-key" ><option value="Bug Report">Bug Report</option><option value="Task">Task</option><option value="Feature Request">Feature Request</option><option value="Support Request">Support Request</option></select

Priority:

<label class="option"><input type="radio" name="field_priority[key]" value="1"   class="form-radio" /> Urgent</label>
</div>
<div class="form-item">
 <label class="option"><input type="radio" name="field_priority[key]" value="2"   class="form-radio" /> Normal</label>

</div>
<div class="form-item">
 <label class="option"><input type="radio" name="field_priority[key]" value="3"   class="form-radio" /> Anytime</label>
</div>

Status:

 <label class="option"><input type="radio" name="field_issue_status[key]" value="Active"   class="form-radio" /> Active</label>

</div>
<div class="form-item">
 <label class="option"><input type="radio" name="field_issue_status[key]" value="Needs Review"   class="form-radio" /> Needs Review</label>
</div>
<div class="form-item">
 <label class="option"><input type="radio" name="field_issue_status[key]" value="Fixed"   class="form-radio" /> Fixed</label>
</div>
<div class="form-item">
 <label class="option"><input type="radio" name="field_issue_status[key]" value="Duplicate"   class="form-radio" /> Duplicate</label>
</div>

Project:

 <select name="field_project[nids]" class="form-select required" id="edit-field-project-nids" ><option value="741">Fun Project 1</option><option value="749">Cool Project 2</option><option value="699">Hard Project 3</option></select>

So if I do any of the following it works:
domain.com/node/add/issue&edit[field_issue_type][key]=Task
domain.com/node/add/issue&edit[field_priority][key]=1
domain.com/node/add/issue&edit[field_issue_status][key]=Active
domain.com/node/add/issue&edit[field_project][nids]=749

Priority Key 1 will set it to "Urgent" and Project NIDS 749 will set it to "Cool Project 2," beautiful and thanks!!!

Now... how to make it so we can set multiple fields in the same URL? First I was using "?" in the url but now I changed them to "&" and it all works! This sets everything:

domain.com/node/add/issue&edit[field_issue_type][key]=Task&edit[field_priority][key]=1&edit[field_issue_status][key]=Active&edit[field_project][nids]=749

Many thanks, this is great!
Chris

add1sun’s picture

Title: Pre-populate with CCK select boxes » Document using CCK select boxes
Component: Miscellaneous » Documentation
Category: support » task

Moving this to a docs task so it is clear for others in the future.

jbrauer’s picture

Status: Active » Closed (fixed)
mudatrust’s picture

Version: 5.x-1.x-dev » 6.x-2.1