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.
The drupal core enables add fields to a "profile", without using the module Profile2, like any entity. when the administrator is creating a user account would be really good that the fields shown to depend on the selected role for this new user.
for example:
I have two roles, worker and student.
I have two fields created, workplace and school.
if I select worker should ask me as required field work downtown and do not show the school field, and vice versa.
would be great to have this functionality in this useful module.
Comments
Comment #1
peterpoe CreditAttribution: peterpoe commentedYou can use the Field Permissions module to do this: http://drupal.org/project/field_permissions
Comment #2
reych9 CreditAttribution: reych9 commentedYou did not understand me I do not think field_permissions solve my problem.
field_permissions hides the fields acording to the role of the active user.
on my site only the administrator can create a new account, and is the administrator who selects what role will have this new account.
the utility I need is that according to the role selected by the administrator for this new account, show or hide the fields to be filled by the administrator.
field_permissions detects who is the manager and showed him all the fields.
Comment #3
peterpoe CreditAttribution: peterpoe commentedSorry, I misread. Conditional Fields only supports Field API fields. If you want to add a dependency for form elements that are not fields, you have to code it. You can write your own code, maybe using the conditional_fields_attach_dependency() function in a custom module, but I think it's currently broken for custom dependencies.
Having an UI for custom dependencies would be nice though.
Comment #4
reych9 CreditAttribution: reych9 commentedthanks for your prompt replies, I'm not an expert programmer, I'm just a novice, I hope shortly to delve a little deeper into the drupal code.
for now I'm trying to solve the problem by creating a new static field with all the roles, hiding the original roles field and linking them with onclic jabascript event, but I found a new problem, I have just post it,
thank you very much again.
Comment #5
MustangGB CreditAttribution: MustangGB commentedThis was as far as I got before getting stuck.
Comment #6
liquidcms CreditAttribution: liquidcms commentedanyone make any progress on this?