Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean switch unuseable inside flow part #3944

Open
Flarescape opened this issue Jul 17, 2019 · 9 comments
Open

Boolean switch unuseable inside flow part #3944

Flarescape opened this issue Jul 17, 2019 · 9 comments
Labels
Milestone

Comments

@Flarescape
Copy link

Flarescape commented Jul 17, 2019

As the title says, the boolean field switch does not work inside a flow part.
The switch does nothing on click.

@Flarescape Flarescape changed the title Vue content picker error makes boolean switch unuseable Boolean switch unuseable inside flow part Jul 17, 2019
@sebastienros sebastienros added this to the rc milestone Jul 18, 2019
@Skrypt
Copy link
Contributor

Skrypt commented Aug 9, 2019

A BagPart content item boolean field switch doesn't work.
Repro :

screencapture-localhost-44300-Admin-Contents-ContentTypes-Acme-Create-2019-08-09-16_17_17

Here is the rendered Bootstrap switch :

<span class="switch">
        <input type="checkbox" class="switch switch-sm content-preview-select" data-val="true" data-val-required="The Value field is required." id="z99ffbbf8e726edae142ff0bb052f263_Acme2_Active_Value" name="399ffbbf8e726edae142ff0bb052f263.Acme2.Active.Value" value="true">
	<input name="399ffbbf8e726edae142ff0bb052f263.Acme2.Active.Value" type="hidden" value="false">
	<input name="399ffbbf8e726edae142ff0bb052f263.Acme2.Active.Value" type="hidden" value="false">
        <label for="z99ffbbf8e726edae142ff0bb052f263_Acme2_Active_Value">Active</label>
</span>

If I'm removing the 2 hidden inputs that are placed in between the checkbox and it's label then the switch works. So, here the hidden inputs needs to be appended before the checkbox input or after it's label else it breaks the component.

@Skrypt
Copy link
Contributor

Skrypt commented Aug 9, 2019

I tested the preview here with the predefined lists to make sure it's working with a BagPart and it worked.

@sebastienros
Copy link
Member

maybe a conflict when there is another one on the page like in the screenshot?

@Skrypt
Copy link
Contributor

Skrypt commented Aug 9, 2019

Not related to having an other one. I added it on the main content type to see the difference in the HTML rendered but it was not working for the one in the BagPart before I added the one on the main content type.

@Skrypt
Copy link
Contributor

Skrypt commented Aug 9, 2019

There is clearly an issue when the hidden inputs are appended since we can see that they are duplicates.

@Skrypt
Copy link
Contributor

Skrypt commented Aug 9, 2019

Here is the HTML of the main content type one :

<span class="switch">
        <input type="checkbox" class="switch switch-sm content-preview-select" data-val="true" data-val-required="The Value field is required." id="Acme_Active_Value" name="Acme.Active.Value" value="true">
        <label for="Acme_Active_Value">Active</label>
</span>

No hidden input required for this one. So it might be an issue with the preview script or the FlowPart script.

@Skrypt
Copy link
Contributor

Skrypt commented Aug 9, 2019

It's not coming from the contentpreview.edit.js.

@sebastienros sebastienros modified the milestones: rc, 1.0 Aug 11, 2019
@agriffard
Copy link
Member

When you add in a Form a widget that has a BooleanField, it adds 2 hidden input. Ex:

<span class="switch">
        <input type="checkbox" class="switch switch-sm content-preview-select" data-val="true" data-val-required="The Value field is required." id="z059826f467d4e1dab99b79ae8c02b67_RichContent_Visible_Value" name="2059826f467d4e1dab99b79ae8c02b67.RichContent.Visible.Value" value="true">
<input name="2059826f467d4e1dab99b79ae8c02b67.RichContent.Visible.Value" type="hidden" value="false">
<input name="2059826f467d4e1dab99b79ae8c02b67.RichContent.Visible.Value" type="hidden" value="false">
        <label for="z059826f467d4e1dab99b79ae8c02b67_RichContent_Visible_Value">Visible</label>
    </span> 

If the field is using a switch Editor, it prevents to switch the property after the widget is added.

When it is saved and reedited, the 2 inputs don't appear anymore and it works.

@sebastienros
Copy link
Member

Can we check that this line is not generated twice also in a standard editor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants