Populate fields when a checkbox is clicked on a form I have a regular drupal 7 form (based on a content type called guests) where I need a "Bring my partner" checkbox. When the checkbox is clicked, a field collection field (first name/last name/address) needs to be prefilled basing on the details for the currently logged-in user. (Partner details are in my user account details.) 

Can this be done in hook_form_alter()? Is there any other way to achieve this?
You could do this with hook_form_alter and add a state to the field that needs to be hidden.

$form["first_name"] = array(
    "#states" =&gt; array(
        "invisible" =&gt; array(
            ":input[name='bring_parter']" =&gt; array(
                "checked" =&gt; FALSE,
            )
        )
    ),
);


What this does is hides the "first_name" unless "bring_partner" is checked. More info here