GithubHelp home page GithubHelp logo

Same ID on radios element about former HOT 3 CLOSED

formers avatar formers commented on July 17, 2024
Same ID on radios element

from former.

Comments (3)

Anahkiasen avatar Anahkiasen commented on July 17, 2024

Actually no you should not be able to so that but Former lacks a way to set attributes to checkable elements individually so I'll probably implement something along this. :)

from former.

codivist avatar codivist commented on July 17, 2024

radios also don't carry over their values if there if the form doesn't validate.

Thanks for your awesome work on this. Its an excellent bundle, and makes creating forms so much nicer.

from former.

Anahkiasen avatar Anahkiasen commented on July 17, 2024

Ok so for the id problem it came from the way Laravel links a field to its label, the problem was with multiple checkables Laravel refered to the main label instead of the one assigned to each checkable. So now the for="" attribute gets assigned to the checkable's label instead of the field's and everything should be good. Tell me if it's better.

On the other hand I implemented your idea so you're now able to fine-tune checkboxes and radios by passing an array of attributes on a per-checkable basis.

Former::radios('radio')
  ->radios(array(
    'label' => array('name' => 'foo', 'id' => 'foo', 'value' => 'bar', 'data-foo' => 'bar'),
    'label' => array('name' => 'foo', 'id' => 'bar', 'value' => 'bar', 'data-foo' => 'bar'),
  ));

So now at least if you really need a particular id you can set it in the checkable's attributes array.
All the old methods are still working so say if you omit the name from the custom array it will still be computed in background.

Anyway, here you go. Tell me if everything's better, if it's solved, I'll close the issue.

from former.

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.