Module works fine with one category.
But if defined more categories, the form can not posted (Form submit error: "You must select a valid category"). The category value should still be set automatically? The form has also no drop down list.

Comments

pepelucai’s picture

I have the same issue.

In contact_form_blocks.module function contact_form_blocks_content line 102:
$form['cid'] = array('#type' => 'value', '#value' => $category);

This set the implicit category, but in the Implements hook_form_FORM_ID_alter() of contact_site_form() line 200:
function contact_form_blocks_form_contact_site_form_alter(&$form, &$form_state, $form_id) {
$form['#submit'][] = '_contact_form_blocks_submit';
}
If I debug with dpm form we have lost the property set un contact_form_blocks_content for cid and now form['cid']['#type'] has "select"value

If I force in this function $form['cid'] = array('#type' => 'value', '#value' => 6); (6=a valid category of my list of categories of contact form) the email is send.
But I don't know how get the category in this function

stevebird’s picture

In contact_form_blocks.module function contact_form_blocks_content line 102:
$form['cid'] = array('#type' => 'value', '#value' => $category);

I have changed this line into: $form['cid'] = array('#type' => 'hidden', '#value' => $category, '#name' => 'cid'); It's renders a hidden field into the form with category value and is works.

fuerst’s picture

Just a note: That problem probably is related to a proper fix of #1433234: General cleanup and fixes for 7.x

guy_schneerson’s picture

This is the same issue as Mails always sent with default category for all blocks
and I have posted a patch solving this issue in another way, however if changing the type to hidden fixes the issue then it is a simpler fix.