I would like to know what is the best way to handle this scenario using Drupal 7.

The issue I am facing is that the Join (registration) forms, and Profile forms are different for all 4 types of users I am working with. The registration and profile forms are all connected to one master profile form. This means that if a field is required for one, it will be for all of users, how can I avoid this? What is the best way to go about it?



Required By role

Field required by role is a module that improves core "required" functionality.

Similar to CCK Required by role brings extra features such as:

Ready for all entities, including custom entities. Doesn´t need extra configuration, just install. Respects previous configuration. Configuration per field instance.


You can do it by hook_form_alter. Alter the #required attribute of field according to specific condition.

For example:

function mymodule_form_alter(&$form,&$form_state) {
    if ($form_id == 'user_register_form') {


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.