Since there's no "#options" or #default_value field in the hierarchical select, how would I pre-populate the dropbox with items that a user would have selected in e.g. a previous form submit. I.e. the user selects one or more items within a HS form, submits the form and the selection gets stored in my module's database tables. At a later point the user wants to review and change his/her selection, once again presented in the HS form; in that case I need to pre-populate the HS dropbox with the entries as stored in the database.
How do I setup the form such that I can pre-populate the dropbox (I can't seem to find the specific info in neither the API doc nor the code samples)? Do I use hook_hierarchical_select_create_item() for this? Or do I use one (which one?) of the Javascript events for this; which of the JS events triggers before the HS is rendered first time before any user triggered events?
RK
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | Picture 1.png | 6.86 KB | wim leers |
Comments
Comment #1
wim leersJust set #default_value.
An example for a taxonomy HS.
The vocabulary with vid 3 has the following terms:
- 6: Ford
- 7: Fiesta
The following piece of code:
would result in the attached screenshot.
Comment #2
rkoeten commentedIt's working for me right now. Thanks for the clarification.
RK
Comment #3
wim leersGreat! :)
Actually, I should document this!
Comment #4
wim leersDocumented: http://drupal.org/node/319190.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.