Page: node/227/webform/conditionals

Every time I'm reloading the page I get these two messages.

Notice: Undefined index: #name in foo_preprocess_textfield() (line 213 of sites\all\themes\foo\theme.form.inc).
Notice: Undefined index: #name in foo_preprocess_textfield() (line 213 of sites\all\themes\foo\theme.form.inc).

This means the form name is not defined.

/**
 * Implements theme_preprocess_textfield().
 */
function foo_preprocess_textfield(&$variables) {
  switch ($variables['element']['#name']) {
    case 'search_block_form':
      ...

Comments

quicksketch’s picture

This is probably caused by Webform's conditional fields. When you select a source component, the "value" field for each component is created via JavaScript. These fields are pre-rendered client-side and then JS populates the appropriate "name" attribute when the field is used. This approach makes it so that building conditionals still utilizes the theme layer for generating fields but doesn't require an AJAX request to create the field.

Either that or this problem is caused by date and time fields, which again use textfields rendered server-side. See webform_conditional_form_date() and webform_conditional_form_time(). Which kind of components seem to be causing the problem?

hass’s picture

StatusFileSize
new50.46 KB

Missed to attach debug out. Looks like a date field.

2013-07-09_005717.png

danchadwick’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Closed for lack of activity. Please re-open if this is still an issue in the latest 7.x-4.x-dev.

hass’s picture

Status: Closed (cannot reproduce) » Active

Bug has not fixed.

danchadwick’s picture

Status: Active » Closed (works as designed)

From quicksketch's answer, I believe this is something that you will have to work around in your foo theme.

hass’s picture

Status: Closed (works as designed) » Active

Nope, the bug need to be fixed in the module.

danchadwick’s picture

Status: Active » Postponed

I'll be happy to review and commit any patch you provide.

I am trying to work through a multi-year old backlog of issues on the current release. This is not an issue that I plan on working on, and I'm pretty sure quicksketch isn't either. The workaround is trivial, and without investigating further, it appears that that changes here may have unintended consequences. Let's leave the status as postponed, pending your patch.

hass’s picture

Status: Postponed » Active

  • DanChadwick committed 87a0b51 on 7.x-4.x
    Issue #2037561: Provide #name attribute for dynamic conditional...
  • DanChadwick committed 014dbe5 on 8.x-4.x
    Issue #2037561: Provide #name attribute for dynamic conditional...
danchadwick’s picture

Status: Active » Fixed
StatusFileSize
new2.28 KB

Committed to 7.x-4.x and 8.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.