In the contribution form, as the user select the donor, I would like to show some contact info, including both demographic information (eg. email) and custom fields. How can I do it? Thanks
I'm not entirely clear on the meaning of "as the user select the donor", but it sounds like you're trying to add some additional fields to a contribution form. This can be done with Profiles, which in CiviCRM amount to a collection of fields, which can be used in a number of ways, including adding them to Contribution page or Event registration form.
A summary of steps for your use case would be something like this (more information is available in the CiviCRM User and Administrator Guide -- from which I've borrowed heavily -- here: https://book.civicrm.org/user/current/organising-your-data/profiles/):
1. Create a profile:
- Go to: Administer > Customize Data and Screens > Profiles and click on Add Profile.
- Profile Name: Give the profile a meaningful name.
- Used For: Check the "CiviContribute" check box.
- Order: Leave blank; this setting will be populated automatically and is not relevant for this use case.
- Pre-form Help and Post-form Help: These fields allow you to write text that appears either before or after your Profile to guide people in filling out forms.
- Is this CiviCRM Profile Active?: This box is checked automatically and should be left as such; later on, if you want to take a Profile out of use in your organization, you can edit the Profile and un-check the box.
- Click "Save" to create the profile. This will save your settings and open up a form to add a field to the profile.
2. Add fields to the profile:
Now that you have a profile, it needs fields.
- (If you're not already on the "New Profile Field" form) Go to: Go to: Administer > Customize Data and Screens > Profiles, and find the profile you've created; click its "Fields" link, which will open the "CiviCRM Profile Fields" page for this profile; click the "Add Field" button on this page, which will open the "New Profile Field" form.
- Set field options as you wish:
- Field Name: Choose the record type where your desired field appears from the - select - dropdown menu. This will bring up a secondary dropdown menu listing all available fields for that record type. Choose the field you want to add to your Profile.
- Field Label: This is the field label that will display on all uses of your Profile. It is prefilled with the default field label. However, the default field labels are often confusing for users of your forms, so you can rewrite them here. For example, the Postal Code field can be renamed Zip Code if your audience is more familiar with that term.
- Required?: Check this box to make this required anytime the Profile is used. This is most useful when you want to make sure that certain information (e.g., First Name, Last Name, Email) is always included in a form submission.
- View Only?: Check this box to allow users to view but not edit this field.
- Visibility: Set to "User and User Admin only". This ensures that other visitors to the form can't view any data from the database.
- Field Pre Help and Field Post Help: These fields allow you to write text that appears in the user interface to guide people in filling out forms. Field pre help appears inline. Field post help will create a small help bubble which when clicked appear in a help overlay.
- Order: You can use this field to control the order in which fields display in the Profile. Lower numbers are displayed ahead of higher numbers. I recommend leaving this as-is, and adjusting field order on the "CiviCRM Profile Fields" page for this profile.
- Active?: Leave this box checks to ensure that the field appears when the Profile is used; you can un-check it later if you wish to prevent a specific field from appearing in the profile.
- Click Save and New to add more fields to the Profile, or Save if you have no more fields to add.
3. Add the profile to the Contribution page:
- In the Contribution page configuration, navigate to the "Include Profiles" tab.
- Here you'll find two settings: "Include Profile (top of page)" and "Include Profile (bottom of page)". Select your new profile in either one of these, to have your profile displayed at top or bottom of the contribution page.
- Click "Save" to save the configuration.
After this, you can modify the profile configuration as needed; changes to profile settings, changes to field settings, or addition, removal or disabling of fields, will all be reflected in the contribution page. You can also add one profile to as many contribution pages or event registration forms as you wish.