Comments (7)
If that helps, because I have been looking for a while before finding
{{ Form::radio('name', 'M.', true, ['class' => 'form-check-input', 'id' => 'id_man']) }}
{{ Form::label('id_man', 'M.', ['class' => 'form-check-label']) }}
{{ Form::radio('name', 'Mme', '', ['class' => 'form-check-input', 'id' => 'id_female']) }}
{{ Form::label('id_female', 'Mme', ['class' => 'form-check-label']) }}
On the Radio Input, before the options array, add an empty option '' or 'true' for selecting by default.
Work on V 5.7 and 6
from html.
We accept pull requests.
from html.
I can work on this but I would like to know what you would expect to happen if a user uses the code above:
Form::radio('foo', '1');
Form::radio('foo', '2');
Some kind of a warning letting the developer know that id must be unique? Get crazy and throw an exception?
from html.
@marcusmoore88
The problem is that the function expects name
= id
, which is okay for most form elements, but not radio buttons. Radio buttons work because they all have the same name
, but must not have the same id
if you want to connect them to label
elements. Most developers write
<label><input type='radio' [...] /> Label for this option</label>
thus obviating the need for the input
element to have an id
anyway.
Two Proposals:
- Drop the automatically generated
id
. This will force developers to add inid
through theoptions
parameter if they need it - Append the
value
of the radiobutton to the givenname
to generate a uniqueid
for each radio button
Both will likely break existing HTML generated with this function, but then again the existing HTML generated is already broken.
from html.
A combination of the two will satisfy most people. Have a default and have the option to overwrite it.
from html.
I noticed that if you pass in an id
over the options
parameter, the function will prefer that to the one it tries to generate. So for now I'm passing ['id' => NULL]
as the fourth parameter. It's not ideal - the function shouldn't be generating broken HTML by default, but it works well enough.
from html.
The simplist solution here, for the time being, is to not use the Form::label()
method for this particular checkbox. Since it's simply an HTML helper, try using raw HTML <label>
tags, and the form builder will not add the ID to the element.
from html.
Related Issues (20)
- Site
- Active fork
- Html
- <!DOCTYPE html> <html> <head> <title>Parcel Sandbox</title> <meta charset="UTF-8" /> </head> <body> <canvas id="canvas"></canvas> <script src="./index.js" type="module"></script> </body> </html>
- Html
- My html project
- Html
- Sf
- Html
- Laravel 11 Compatible Fork Is Here [INFO] HOT 5
- Flexiwork
- Teste1
- Nelzy Webpage Simple
- Html
- G
- Portfolio
- Dg
- Carta
- Project
- Laravel 11 php 8.2 not working. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html.