Comments (2)
Try defaultChecked(1 === $user->optout)
or binding the form to the user object. I’m on my phone right now—let me know if that doesn’t work and I’ll check when I’m at my laptop.
from aire.
Just got back to my laptop. There are two ways to do this:
{{ Aire::checkbox('optout', 'Opt out')->defaultChecked(1 === $user->optout) }}
Or:
{{ Aire::bind($user) }}
{{ Aire::checkbox('optout', 'Opt out') }}
Calling bind()
will bind all the user values to the form. Because optout
is the name of the checkbox and also the name of the user attribute, it will automatically be checked if $user->optout
is true.
from aire.
Related Issues (20)
- Set default div class for element group div
- Data Binding does not work with Enum-casted properties
- Customize the translation
- <optgroup> Support for <select> Component HOT 3
- Bootstrap 5 support HOT 2
- Show a red / black asterisk in bracket (*) beside the title of required field HOT 1
- prependEmptyOption() isn't used in select if one of the values is 0 HOT 1
- A way to use setAttribute() at the group level, rather than the element level? HOT 3
- npm run build does not compile necessary CSS classes HOT 1
- Validation Messages (client) are not being displayed correctly HOT 1
- No error class & message appear when submitting using Livewire
- Default placeholder to label text
- default_classes won't owerride classes of element HOT 1
- Implement repeatable fields or collection HOT 4
- ClientSide validation not working with vue HOT 2
- defaultValue does not work with checkbox elements HOT 3
- Depreciation notices with PHP 8.1 HOT 1
- Carbon date in DateTimeLocal input does not render HOT 2
- Support for optgroups in select
- Rules error in blade component HOT 2
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 aire.