Checkbox not saving properlly

I have a problem when selecting a checkbox. It enables the save button twice and if I save the second time or click in preview after the first save the checkbox update is removed. For a better understanding the steps of reproducing the bug is detailed below.

1- Select checkbox as true.
2- Click the “Save” button to update it.
3- Information in page editor updates correctly.
4- Click “Preview” button.
5- The update is undone, and the checkbox appears saved as unchecked.

or

1- Select the checkbox as true.
2- Click the “Save” button to update it.
3- Information on the right side in the page editor updates correctly.
4- The “Save” button appears enabled again without a new update.
5- Click the “Save” button again.
6- The update is lost, and the checkbox is saved as unchecked. Even if we did not uncheck it, it was appearing as checked.

PS.
We believe it is due to xp7 installation since the previous version was not occurring this problem. Any thoughts on how to solve it?

We have updgraded and released the site as XP7 recently, follow the details of our enonic version:
xp-app | # Enonic XP 7.1.1
xp-app | # Built on 2019-10-03T09:59:39+0200 (hash = d88866abbff4f9c6d27035a79c1e48abb74f2730, branch = 7.1)
xp-app | # OpenJDK 64-Bit Server VM 11.0.4 (AdoptOpenJDK)
xp-app | # Linux 5.0.0-37-generic (amd64)
xp-app | # Install directory is /enonic-xp
xp-app | # Home directory is /enonic-xp/home

Are you talking about a checkbox inside a content type? Tested it on 7.1.2 but wasn’t able to reproduce. Generally speaking it’s very strange that Preview button causes any changes. It does save content but only if it hasn’t been saved yet (and you claim you save the changes).

Can you share your content type? Maybe some other inputs cause this behaviour.

First, thanks for the quick response. In this case I save a first time after the update but a second save is available and that is why the preview causes a change, i guess. About the content type, to be more precise the checkbox is defined in a mixin but I am sharing both of the files below.

Content Type:

<content-type>
	<display-name>Kurs/Arrangement</display-name>
	<description>Kurs/Arrangement</description>
	<super-type>base:structured</super-type>
	<!-- <display-name-expression>${title}</display-name-expression> -->

	<form>

		<field-set>
            <label>Header</label>
            <items>

	            <input name="heading" type="TextLine">
	                <label>Overskrift</label>
	                <occurrences minimum="1" maximum="1"/>
	            </input>

	            <input name="cover" type="ImageSelector">
	                <label>Header-bilde</label>
	                <help-text>Dette bilde brukes også sammen med overskrift og ingress på diverse undersider.</help-text>
	                <occurrences minimum="0" maximum="1"/>
	            </input>

                <mixin name="header-button" />
            </items>
        </field-set>

		<mixin name="event-info" />
		
		<mixin name="search" />

        <field-set>
            <label>Innhold</label>
            <items>

		        <input name="description" type="HtmlArea">
		            <label>Tekst</label>
		            <occurrences minimum="0" maximum="1"/>
                    <config>
                        <include>HorizontalRule</include>
                    </config>
		        </input>

            </items>
        </field-set>

        <field-set>
            <label>Faktaboks</label>
            <items>            

                <item-set name="rightAlignedFactBoxes">
                    <label>Høyrestilt Faktaboks</label>
                    <occurrences minimum="0" maximum="0"/>
                    <items>
                        <input name="image" type="ImageSelector">
                            <label>Bilde</label>
                            <help-text>Vises over teksten</help-text>
                            <occurrences minimum="0" maximum="1"/>
                        </input>
                        <input name="title" type="TextLine">
                            <label>Tittel på Faktaboks</label>
                            <help-text>Vises over bildet</help-text>
                            <occurrences minimum="0" maximum="1"/>
                        </input>
                        <input name="body" type="HtmlArea">
                            <label>Tekst</label>
                            <help-text>Vises under bildet</help-text>
                            <occurrences minimum="1" maximum="1"/>
                        </input>
                    </items>
                </item-set>

            </items>
        </field-set>
	</form>
</content-type>

Mixin:

<mixin>
<display-name>Event Info</display-name>
<form>

    <field-set>
        <label>Tid og Sted</label>
        <items>

                <input name="startDateTime" type="DateTime">
                    <label>Fra</label>
                    <occurrences minimum="1" maximum="1"/>
                </input>

                <input name="endDateTime" type="DateTime">
                    <label>Til</label>
                    <occurrences minimum="0" maximum="1"/>
                </input>

                <input name="location" type="TextLine">
                    <label>Sted</label>
                    <occurrences minimum="1" maximum="1"/>
                </input>

        </items>
    </field-set>


            
    <field-set>
        <label>Påmeldingsinformasjon</label>
        <items>

            <input name="registrationDeadline" type="Date">
                <label>Påmeldingsfrist</label>
                <occurrences minimum="1" maximum="1"/>
            </input>
            
            <input name="kursNummerFromFocus" type="Long">
                <label>Kursnummer fra Focus (Påmeldingsknapper vises ikke uten denne)</label>
                <occurrences minimum="0" maximum="1"/>
            </input>

            <input name="maxParticipants" type="Long">
                <label>Maks Antall Deltagere</label>
                <occurrences minimum="0" maximum="1"/>
            </input>
            <input name="openSpaces" type="Long">
                <label>Antall ledige plasser</label>
                <occurrences minimum="0" maximum="1"/>
            </input>

            <input name="hideAvailableSeats" type="checkbox">
                <label>Skjul ledige plasser</label>
                <occurrences minimum="0" maximum="1"/>
                <default>checked</default>
            </input>
            
            <input name="hidePriceBoxes" type="checkbox">
                <label>Skjul pris</label>
                <occurrences minimum="0" maximum="1"/>
            </input>

        </items>
    </field-set>

    <mixin name="event-prices" />
    
</form>
</mixin>

I couldn’t reproduce it with your schemes either (under 7.1.2). When I change checkboxes “Skjul ledige plasser” or “Skjul pris” and click Save, the button becomes disabled and stays like that until I make some other changes.

  1. Can you install “Content Viewer” widget from the Market and check if data actually changes when you save?
  2. Can you test your app under latest XP 7.2 / Content Studio 2.3?

Looks like a bug in Content Studio (2.2.4)
As described above, a click on preview does trigger a Save/Update.
Except this time the update is sent with “null” as value for hidePriceBoxes

Sorry for late return but as suggested:

  1. Yes! The save changes the data in content viewer.
  2. The bug continued with both latest versions.