Skip to content

plone.patternslib alters select widget via javascript #21

@holdenhao

Description

@holdenhao

After activating p.patternslib (tested on 1.2.1 on Plone 5.2.3/py3), the the normal select widget structure is altered by javascript. The option 'siblings':True no longer works and the field label is always shown.

Normal

<div data-pat-inlinevalidation="{&quot;type&quot;:&quot;z3c.form&quot;}" class="field pat-inlinevalidation kssattr-fieldname-form.widgets.slaveField2 None" data-fieldname="form.widgets.slaveField2" id="formfield-form-widgets-slaveField2" style="display: block;">
    <label for="form-widgets-slaveField2" class="horizontal">
        SlaveField2
        <span class="formHelp">This field's visibility is controlled by the value selected in masterField. It will become invisible when the values 2 or 4 are selected.</span>
    </label>
    <div class="fieldErrorBox"></div>
<select id="form-widgets-slaveField2" name="form.widgets.slaveField2:list" class="select-widget choice-field" size="1">
<option id="form-widgets-slaveField2-novalue" value="--NOVALUE--">No value</option>
...

New structure (note the additional span tags)

<div data-pat-inlinevalidation="{&quot;type&quot;:&quot;z3c.form&quot;}" class="field pat-inlinevalidation kssattr-fieldname-form.widgets.slaveField2 None" data-fieldname="form.widgets.slaveField2" id="formfield-form-widgets-slaveField2" style="">
    <label for="form-widgets-slaveField2" class="horizontal">
        SlaveField2
        <span class="formHelp">This field's visibility is controlled by the value selected in masterField. It will become invisible when the values 2 or 4 are selected.</span>
    </label>
    <div class="fieldErrorBox"></div>
<span data-option="No value"><span data-option="No value" data-option-value="--NOVALUE--"><select id="form-widgets-slaveField2" name="form.widgets.slaveField2:list" class="select-widget choice-field" size="1">
<option id="form-widgets-slaveField2-novalue" value="--NOVALUE--">No value</option>
....

Deactivation of p.patternslib does not remove the installed javascript. It needs to be disabled from the resource registry in the control panel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions