enonic / lib-admin-ui

Enonic XP Administration UI.
GNU General Public License v3.0
5 stars 5 forks source link

Checkboxes inside an option-set must be reset to default values after selected option was reset #1901

Closed ashklianko closed 3 years ago

ashklianko commented 3 years ago

@sgauruseu commented on Wed Mar 03 2021

  1. Create new content
  2. Fill out display name
  3. Select option "Text block"
  4. Check off both "Full width" and "Sidebar image" in the inner option-set
  5. Select some image inside the "Sidebar image" form

image

  1. Click on Reset, confirm and save this content. image

  2. Select option "Text block" again

image

BUG: Both checkboxes are selected and styles is not original.

Expected - checkboxes should be unselected

The similar issue with attachments in the option set. Attachments are not cleared after resetting the option image

Content type:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<content-type xmlns="urn:enonic:xp:model:1.0">
  <display-name>OptionSet</display-name>
  <super-type>base:structured</super-type>
  <form>
    <option-set name="radioOptionSet">
      <label>Single selection</label>
      <occurrences minimum="1" maximum="1"/>
      <options minimum="1" maximum="1">
        <option name="ctbText">
          <label i18n="ct.article.ctbText">Text block</label>
          <items>
            <input name="content" type="TextLine">
              <label>Content</label>
              <occurrences minimum="0" maximum="1"/>
            </input>
            <option-set name="ctbSettings">
              <label>Settings for content block</label>
              <occurrences minimum="1" maximum="1"/>
              <options minimum="0" maximum="10">

                <!-- Full Width -->
                <option name="fullWidth">
                  <label>Full width</label>
                </option>

                <!-- Sidebar image -->
                <option name="sidebarImage">
                  <label>Sidebar image</label>
                  <items>
                    <input name="image" type="ImageSelector">
                      <label>Image</label>
                      <occurrences minimum="1" maximum="1"/>
                      <config>
                        <allowPath>${site}/*</allowPath>
                      </config>
                    </input>
                    <input name="caption" type="TextLine">
                      <label>Caption</label>
                      <occurrences minimum="0" maximum="1"/>
                    </input>
                  </items>
                </option>
              </options>
            </option-set>
          </items>
        </option>
        <option name="ctbImages">
          <label>Images</label>
          <items>
            <option-set name="ctbSettings">
              <label>Settings for content block</label>
              <occurrences minimum="1" maximum="1"/>
              <options minimum="0" maximum="10">
                <!-- Full Width -->
                <option name="fullWidth">
                  <label>Full width</label>
                </option>
              </options>
            </option-set>
          </items>
        </option>
      </options>
    </option-set>
  </form>
</content-type>

@alansemenov commented on Tue Apr 06 2021

@sgauruseu can you check if this has been fixed by the latest changes?


@sgauruseu commented on Wed Apr 07 2021

The first case is still reproducing, but there are no problems with the clearing of attachments


@ashklianko commented on Wed Apr 07 2021

Will be fixed in https://github.com/enonic/lib-admin-ui/pull/1890

ashklianko commented 3 years ago

Added update of checkbox state in FormOptionSetOptionView on update

ashklianko commented 3 years ago

pushed into https://github.com/enonic/lib-admin-ui/pull/1895