Closed (outdated)
Project:
Prepopulate
Version:
6.x-2.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
15 Feb 2009 at 12:16 UTC
Updated:
22 Jan 2018 at 07:37 UTC
Jump to comment: Most recent
Comments
Comment #1
patchak commentedplease, please!! Anyone has an idea how to do this??
Patchak
Comment #2
mgl4421 commentedHow did you prepopulate the registration form fields? I suspect the problems I'm encountering are related to fields within unnamed fieldsets. How would I prepopulate a user's email address and registration code?
Thanks
Comment #3
bentonboomslang commentedI am also having problems prepopulating my user registration fields.
I have used prepopulate elsewhere in my site but I cannot get it to work on the user/register site.
I have CCK and Content Profile installed and I have designated a few fields to be filled in on registration. Is this the case with you mgl4421 and patchak? Perhaps this could be the problem?...
Please let me know! Many thanks,
Ben
Comment #4
Hazlitt commentedI managed to prepopulate user registration fields using another module, have a look at my reply to a similar issue.
Comment #5
alberto56 commentedHi,
I'm having the same issue. Any direction from the maintainers would be appreciated!
Albert.
Comment #6
muckermarc commentedHi,
I needed to pre-populate the user registration form too, but found the following worked for me (after a few hours of messing) with the latest 6.x-2.x-dev version.
If you have Profile fields in the registration form, it'll put these fields into fieldset tags with legend tags to display the name of the fieldset. You'll need to pass the legend text as part of the Prepopulate argument.
Here's an example structure with the fieldset groupings, plus the ID and NAME attributes of the input tags:
To pre-populate Job Title on the registration form via the URL I used the following syntax:
or, via a hidden form element and POST:
Note that the legend text "Personal Information" is case sensitive and that I've URL encoded the space character. Also be careful with the ID and NAME attributes, it's the NAME attribute you want to use, an it has an underscore "_" rather than a hyphen "-".
Confusingly, the Account Information elements (Username and E-mail Address) are handled slightly differently. To pre-populate the E-mail Address use the following syntax:
or, via a hidden form element and POST:
Note that even if the legend reads "Account Information", you need to pass the value [account] instead - and it's case sensitive.
And finally, if you don't have any Profile fields visible on the user registration form, then Username and E-mail Address are not grouped in a fieldset so you need to use:
or, via a hidden form element and POST:
Note the lack of "[account]" in the arguments.
Comment #7
alberto56 commented@muckermarc thanks, your input appreciated.
Comment #8
Breakerandi commentedAny Solutions for content profile fields in the user registration form? thanks..
Comment #9
jruberto commentedJust to share what I just spent an hour figuring out..
(using 6.x-2.x-dev on user registration form)
Account fields:
Profile fields: (note category name is case sensitive)
profile fields: edit[Profile][profile_field_name]phew! To test, just paste that whole first code block into your site's domain to see if it fills in the form for you. Learn your profile field names at /admin/user/profile
Comment #10
davito18 commentedI am trying to pre-populate the regcode field on my registration form. I have set the fieldset title in Regcode module to 'accesscode' and have tried the following combinations but neither work:
I can't work out what the issue is as other fields seem to pre-populate correctly when testing (7.x-2.x-dev). The html code of the field:
Comment #11
gateone commentedActually it is very simply once you know what to look for and where to look for when trying to populate a form field. While the maintainer did a nice job giving all sorts of examples, he never really explained how to address the subject from a pure logic point of view.
Basically the thing with the fieldset is really misleading and won't work in most cases. I also needed to prepopulate the registration code field from the Registration Code module. Taking the idea of the fieldset, I went into regcode.module to look up, how that form field actually is built internally. Now of course I am on Drupal 7 by now, but the idea still is the same.
So initially I was a bit puzzled while reading that on the username or email-fields of the user/register page the URL to use was
http://mysite.com/user/register?edit[account][name]=mynameandhttp://mysite.com/user/register?edit[account][mail]=me%40mysite.comWhat puzzled me here was the [account] but then I remembered that this was in the Form API of Drupal and that these fields' internal form API names really are [account][name] and [account][mail].
So I looked into the Registration Code module and searched for the part where the registration code form actually is produced.
Let me quickly show you the code (again, this is from Drupal 7, there might be some differences to Drupal 6, but the Form API was already pretty much in D6 as it is now in D7:
See how that form is named: $form['regcode']['regcode_code']! So here you have what you really need to use: just get rid of the ' and use this in the URL:
http://www.yourdomain.com/user/register?edit[regcode][regcode_code]=testAnd there it was: the word "test" appears prepopulated right in the field.
So for the Registration Code module, the URL to use for prepopulating the registration code field is:
/user/register?edit[regcode][regcode_code]=somecodeA clearer documentation instead of tons of examples would have saved me an hour of searching around ;-)
Comment #12
jbrauer commentedClosing D6 issues as it's no longer supported.
Comment #13
kourosh.a commentedAny idea how to fix this on D8 version?!
Comment #14
Mike Dodd commentedanyone get this working in D8?