Comments (1)
This is not bug.
Checkbox support base label and input label. By default use input label.
enclosedByLabel(bool)
defined how display labels:
true
- use input label only (default)false
- use base label only
If need display both labels, then need force show base label by hideLabel(false)
.
See examples.
1. Input Label (default)
echo Field::checkbox($form, 'remember_me')
->inputLabel("Remember me please!!!!")
->inputLabelClass('form-check-label mb-0 ms-3')
<div>
<input type="hidden" name="CheckboxForm[blue]" value="0">
<label class="form-check-label mb-0 ms-3">
<input type="checkbox" id="checkboxform-blue" name="CheckboxForm[blue]" value="1"> Remember me please!!!!
</label>
</div>
2. Base Label
echo Field::checkbox($form, 'remember_me')
->enclosedByLabel(false)
->label("Remember me please!!!!")
->labelClass('form-check-label mb-0 ms-3')
<div>
<label class="form-check-label mb-0 ms-3" for="checkboxform-blue">Remember me please!!!!</label>
<input type="hidden" name="CheckboxForm[blue]" value="0">
<input type="checkbox" id="checkboxform-blue" name="CheckboxForm[blue]" value="1">
</div>
3. Both Labels
echo Field::checkbox($form, 'remember_me')
->label("Remember?")
->labelClass('fw-bold')
->inputLabel("Remember me please!!!!")
->inputLabelClass('form-check-label mb-0 ms-3')
->hideLabel(false)
<div>
<label class="fw-bold" for="checkboxform-blue">Remember?</label>
<input type="hidden" name="CheckboxForm[blue]" value="0">
<label class="form-check-label mb-0 ms-3">
<input type="checkbox" id="checkboxform-blue" name="CheckboxForm[blue]" value="1"> Remember me please!!!!
</label>
</div>
from form.
Related Issues (20)
- Remove filter of null values in methods for setting classes HOT 1
- Code style - chain calls HOT 15
- Add `$content` parameter to `Field::*Button()` methods
- Yiisoft\Validator\DataSet\AttributeDataSet not found
- Dependency update/adjust to yiisoft/html HOT 2
- Nested array form with translations HOT 3
- Input field name array HOT 1
- Add php attribute like #[SkipHydration] to skip private properties in collectAttributes() HOT 1
- Naming issue: attribute HOT 1
- Allow use fields without form model HOT 1
- Add constant with default theme and theme parameter to `Field` helper HOT 1
- Make fields indepent from validator HOT 1
- Raise PHP version to 8.1 HOT 1
- Add theme for Bootstap 5 HOT 1
- Checkbox 'checked' parameter input HOT 20
- Add ability partly change theme in `PureFieldFactory`
- Remove scrutinizer
- Change minimum stability in composer.json to stable
- Add method in fields for set closure that prepare value for field
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 form.