An error occurs if you include in the module Webform to send emails in HTML code.

Notice: Undefined index: #type in bootstrap_form_element_label() (line 199 of /.../sites/all/themes/bootstrap/includes/form.inc).

This is most likely due to the fact that the Bootstrap wrapper adds a "control-label" is to all forms

<?php
// @Bootstrap: Add Bootstrap control-label class except for radio.
 
if ($element['#type'] != 'radio') {
   
$attributes['class'][] = 'control-label';
  }
?>

How to avoid this is for the module web form I do not know. It is worth noting that the Bootstrap does not use this class in CSS.

Files: 
CommentFileSizeAuthor
#10 Screen Shot 2014-02-24 at 1.14.04 PM.jpg187.28 KBagerson

Comments

markcarver’s picture

Status:Active» Closed (cannot reproduce)

It was likely an error in the webform module. I cannot reproduce this with the latest dev of this base theme and the latest release of webform.

jmedina’s picture

Any updates on this? Webform still seems to store the data just fine but I am wondering if I can get rid of that warning.

jmedina’s picture

Version:7.x-2.x-dev» 7.x-2.1
Status:Closed (cannot reproduce)» Active

If you still can't reproduce this please feel free to switch the status.

markcarver’s picture

Status:Active» Postponed (maintainer needs more info)

I already tried to reproduce it, I couldn't. Screenshots and reproduction steps (ie: click by click creation of webform/submission) will need to be submitted.

jmedina’s picture

I will try to provide you with more info. This seems similar. https://drupal.org/node/1778642

If it seems to store everything just fine there should be no problem right?

jmedina’s picture

Odd... I seem to only be getting the error with one particular form. Not only that but the module that creates the PayPal donate button is acting up. Not related to this but I am thinking that module is really buggy.

Robin van Emden’s picture

I encounter the same problem with the latest webform (4.x-dev) module - if you view a submission, $element does not contain #type. Maybe you can add

if (isset($element['#type']) && $element['#type'] != 'radio') {

to ensure no warnings are issued, even though another module might be the culprit?

Angry Dan’s picture

I'm getting the same error for a non-related issue.
Adding this helps:

<?php
if (!isset($element['#type']) || $element['#type'] != 'radio') {
?>

Robin, using !isset and || instead because the if should only not run if #type is 'radio'. Probably of little relevance but this is functionally equivalent to current behaviour without the notice.

amberau79’s picture

The fix from #8 solved this for me

agerson’s picture

Issue summary:View changes
StatusFileSize
new187.28 KB

I get this error as well.

jaesperanza’s picture

Hi amberau, how did you exactly implement #8? getting WSOD inserting the line...

jaesperanza’s picture

Please disregard my question, got #8 working by this:

change from:

// @Bootstrap: Add Bootstrap control-label class except for radio.
  if ($element['#type'] != 'radio') {
    $attributes['class'][] = 'control-label';

to:

// @Bootstrap: Add Bootstrap control-label class except for radio.
  if (!isset($element['#type']) || $element['#type'] != 'radio') {
    $attributes['class'][] = 'control-label';

Thanks!