Problem/Motivation

The widget JS doesn't work correctly when a theme has changed form or form item templates

Most of the JS functions determine the wrapper of the current element by looking for a containing "fieldset" element. But that's not specific enough, since themes are free to change things at will. Bootstrap Barrio, for example, wraps each form element (like the time input and date input separately) in its own fieldset. The widget JS finds this new fieldset and is not in the expected context needed to continue.

Steps to reproduce

Download and enable Bootstrap Barrio; set up a node form with a Smart Date widget; edit a node without using the admin theme.

Change a start date, start time or duration field value; the end value does not change correspondingly.

Proposed resolution

Module JS should only rely on attributes or elements specifically added by the module. In this case, instead of looking for a generic fieldset element, we can look for an element with the ".smartdate--widget" class.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 smart_date-3225159-2-widget_js.patch2.72 KBles lim

Comments

Les Lim created an issue. See original summary.

les lim’s picture

Status: Active » Needs review
StatusFileSize
new2.72 KB

Patch attached.

  • mandclu committed 7e0d4c9 on 3.4.x authored by Les Lim
    Issue #3225159 by Les Lim: Widget JS broken for certain themes
    
mandclu’s picture

Status: Needs review » Fixed

Thanks for identifying this, and for providing a fix. Merged in these changes, and plan to roll a new release which will include this.

Status: Fixed » Closed (fixed)

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