Comments (7)
You can do that easily with css with :after
.
label.required:after {
content: " *";
}
from laravel-form-builder.
@kristijanhusak
for adding * on any required field i write code
$this->add("title", "text",["label_attr" => ["class" => "control-label required"]]);
with above css.
can we reduce this code to like as
$this->add("title", "text",["required" => true]);
from laravel-form-builder.
Yeah that's a good idea. Will reopen this until I set it up. Thanks.
from laravel-form-builder.
@dileepmaurya @anandasubedi
Added option required
in the latest release (1.4.25).
$this->add('name', 'text', [
'required' => true
]);
It adds required
class to label, and required
attribute to field. Something like this:
<div class="form-group">
<label class="control-label required" for="name">Name</label>
<input class="form-control" required="required" id="name" />
</div>
from laravel-form-builder.
cool 👍
@kristijanhusak
HTML 5 required attribute in form element look like as
<input type="text" name="usrname" required />
so just put required.
from laravel-form-builder.
@dileepmaurya
Field attributes are handled through Laravel's Form Builder, which does this by itself, check here
from laravel-form-builder.
then its ok. :)
from laravel-form-builder.
Related Issues (20)
- Remove laravelcollective/html HOT 11
- v1.50 breaks field type collection HOT 5
- BUG: radio buttons chioce type returns an array HOT 5
- Feature request: Switching between classes by theme HOT 9
- Please change CHANGELOG and Releases HOT 3
- Select option for null values HOT 3
- Multiple file upload HOT 1
- Feature request: Add conditional field HOT 3
- Add Fieldset type HOT 3
- Compatibility Laravel 9 ? HOT 2
- getFieldValues() default value instead of null HOT 2
- Default placeholder for entity type(Field::ENTITY). HOT 1
- Radio button has problem HOT 2
- Using entity how we can display format with multiple columns HOT 1
- Collection of templated form HOT 2
- Error: count(): Argument #1 ($value) must be of type Countable|array, Mekongdelta\Slug\Models\Slug given HOT 5
- Validate without request HOT 10
- Invalid pattern for input
- At least one "choice" checkboxes required HOT 2
- Support for Laravel 11 HOT 4
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 laravel-form-builder.