Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
pepelucai CreditAttribution: pepelucai commentedI 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
Comment #2
stevebird CreditAttribution: stevebird commentedI 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.
Comment #3
fuerst CreditAttribution: fuerst commentedJust a note: That problem probably is related to a proper fix of #1433234: General cleanup and fixes for 7.x
Comment #4
guy_schneerson CreditAttribution: guy_schneerson commentedThis 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.