By vivdrupal on
Referring to the original topic of the thread http://drupal.org/node/1031354, I have a select option in my user registration form.
Its options are coming from a taxonomy term.
Code similar to the above leaves me with an array :
$user_data = user_load($user->uid);
$dept_tid = $user_data->field_tuv_user_department['und'];In devel I can see the tid is stored in field_tuv_user_department['und']['#default_value']['0'][, but
$dept_tid = $user_data->field_tuv_user_department['und']['#default_value']['0'];
gives "Undefined index: #dafault_value "
Pointers please.
Comments
#default_value #dafault_value
#default_value
#dafault_value
?
That's already corrected as shown in the code
That's already corrected as shown in the code. The error is with the corrected spelling '#default_value'.
okay (this even was too
okay (this even was too simple to be true ^^)
did you already try to access '#value' instead of '#default_value'
What do you mean you know it by devel? did you activate to print the $page array or did you dsm($user_data)?
I used dsm($form)
Thanks for your response.
1. I tried '#value' instead of '#default_value' but got "Undefined index: #value"
2.I did dsm($form) and went to the field name and opened the drop-downs ...
3. dsm($user_data) gives "Undefined variable: user_data"
I guess your order is not
I guess your order is not correct
try:
['und']['0']['#default_value']see this for more info: http://drupal.org/node/1031354#comment-5008970
This gives Undefined index: #default_value
Thanks for your response.
Also my response to http://drupal.org/node/1031354#comment-50099
Undefined index: value
@ vivdruPal, were you able to
@ vivdruPal, were you able to resolve this issue!
Myself stuck on a similar situation, need a contextual value from the user field, but gives the same error. For user itself, the php code is working but for additional fields added to user registration form, it gives this error!
Pls help if you were able tO resolve this!
Thanks.
My final code is like
My final code is like this:
Hope this helps.
Wonderful. It works. Thank
Wonderful. It works. Thank you!
That can be simplified using
That can be simplified using Field data extraction to