views:

69

answers:

1

Hello, Thank you in advance. I am new to Drupal, and I am presently working on Drupal Profile Module. I have couple of questions..

1.Can I add a Custom form field to the Profile module, such that I want a check box field combined with text box. So that when the check box is clicked the text entered in the text box has to be displayed in the Profile page? 2.Can I create sub Category of within a category for better display of data? (something similar to ABOUT YOU is main category and General Info, education, profession are sub categories. Each sub category has Form fields like text boxes, check boxes etc.)

Please help.

+2  A: 
  1. Yes, perfectly possible. You can go the quick and easy way, using Drupal core's profile module. Enable that and under "Administer » users » Profiles" configure, add and remove fields you want during registration and/or user-editing actions. After that, you can use the value of a checkbox in your theme to display a text. Copy user.tpl.php from /modules/user/user.tpl.php if it is not already in your theme.

     <em>... HTML ...</em>
     <?php if ($user->name_of_checkbox_field) : ?>
       <p>Lorem Ipsum</p>
     <?php endif ?>
    

If you need more power, then core profile.module won't suffice. Instead, use node_profile. This is both complex and powerfull, so evaluate this option carefully, don't just install it on a production environment.

  1. No. Not possible with configuration. Both profiles and node_profiles offer fieldsets only unnested. You can, however, add markup or elements in any form in Drupal trough a custom module that implements hook_form_alter(). Or you can change the outputted HTML trough the theme. Be carefull not to change too much functionality in the theme layer: e.g. don't remove form-fields in your theme: that will break at some point.
berkes

related questions