Giter VIP home page Giter VIP logo

Comments (7)

lucasnetau avatar lucasnetau commented on September 25, 2024 1

This is the browser applying the checked flag when the label is clicked on. The label for the checkbox group includes the 'for' attribute and the duplicate ids mean the event is forwarded to the first element of that id. The for attribute can be removed for toggles however there are other javascript errors seen in formBuilder when you have two checkbox fields with the same name.

@kevinchappell Removing the for attribute for toggles is simple enough, generates valid HTML and the toggles will work. However I don't believe we should be fixing any other duplicate ID issues since it is invalid markup.

from formbuilder.

lucasnetau avatar lucasnetau commented on September 25, 2024

Can you please provide a reproduction and some screenshots? I cannot replicate.

Is this with formBuilder or formRender?

from formbuilder.

maysam avatar maysam commented on September 25, 2024

Hi @lucasnetau

It's actually renderer issue, I wasn't clear

https://codepen.io/maysam-the-scripter/pen/poBybPK

here is a demo, when you try to toggle the checkbox in the second form, it toggles the ones in the first form
it works fine when checkbox is not in toggle mode though

from formbuilder.

lucasnetau avatar lucasnetau commented on September 25, 2024

You have the same ID for the control in both forms. So the selector is picking up the first control of that ID. Please adjust your form control ids so that you have valid HTML.

from formbuilder.

maysam avatar maysam commented on September 25, 2024

when this need to be localized, also this is only happening for the toggle, and other fields don't have this problem

in my application, I am rendering same form 4 times and this problem only happens when I turn on the toggle for checkboxes

from formbuilder.

lucasnetau avatar lucasnetau commented on September 25, 2024

We can investigate if the selector can be reduced to target the expected control.

However it still holds that duplicate IDs in a single HTML page is invalid and you cannot expect anything to work. Giving a unique name in the formData JSON prior to render is a quick method (Array.map and append form-- to the name of each control field)

from formbuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.