drupal-forms

drupal: Form API, dynamically hide or show fields based on input

↘锁芯ラ 提交于 2019-12-03 16:46:09
问题 I'm building a form module. One of the early fields is a set of radio buttons. By default the first button is selected. Next I'll have a series of select boxes. One needs to be visible, the others invisible. Then as the user selects a different radio button I want different select boxes to show or hide. How can I hide the field and label by default and show it later dependent upon which radio button (or another select box option for that matter) is chosen? 回答1: You can use the #states

drupal: Form API, dynamically hide or show fields based on input

蹲街弑〆低调 提交于 2019-12-03 06:39:06
I'm building a form module. One of the early fields is a set of radio buttons. By default the first button is selected. Next I'll have a series of select boxes. One needs to be visible, the others invisible. Then as the user selects a different radio button I want different select boxes to show or hide. How can I hide the field and label by default and show it later dependent upon which radio button (or another select box option for that matter) is chosen? You can use the #states property to achieve that. The #states property can be applied to all Form API elements. Here's the documentation

How to redirect user to a specific page after they login if they belong to a certain role?

假装没事ソ 提交于 2019-11-28 12:16:38
We have certain users in our member list that have a role "vendor" attached to them. All such members are to be redirected to a certain page upon login. How can this be accomplished? You can define actions and triggers in Drupal: Action( admin/settings/actions ) - Redirect to a specific page Trigger ( admin/build/trigger/user ) - After user has logged in Try this. EDIT (see comments): Create a small module to check on a user's login process what role he has and then redirect if neccesary. drupal_goto => redirect-function in drupal hook_user =>triggers on user operations And for the user's

How to redirect user to a specific page after they login if they belong to a certain role?

こ雲淡風輕ζ 提交于 2019-11-27 06:53:20
问题 We have certain users in our member list that have a role "vendor" attached to them. All such members are to be redirected to a certain page upon login. How can this be accomplished? 回答1: You can define actions and triggers in Drupal: Action( admin/settings/actions ) - Redirect to a specific page Trigger ( admin/build/trigger/user ) - After user has logged in Try this. EDIT (see comments): Create a small module to check on a user's login process what role he has and then redirect if neccesary