Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing 'form-check-label' class and fix invalid feedback for Bootstrap 4 #601

Merged
merged 3 commits into from
Jan 21, 2021

Conversation

tortuetorche
Copy link
Contributor

@tortuetorche tortuetorche commented Dec 30, 2020

Add missing form-check-label CSS class for Bootstrap 4

E.g. with Laravel:

{!! Former::open()->method('GET') !!}
    {!! Former::checkbox('test')->text('Test checkbox') !!}
{!! Former::close() !!}

Render:

<div class="form-check">
  <input class="form-check-input" id="test" type="checkbox" name="test" value="1">
  <label for="test" class="form-check-label">Test checkbox</label>
</div>

References:


Fix invalid feedback visibility of checkboxes and radios for Bootstrap 4

E.g. with Laravel:

@php
    $validator = Validator::make(request()->all(), [
        'failed_checkbox' => 'required',
        'failed_radio' => 'required',
        'failed_inline_checkbox' => 'required',
        'failed_inline_radio' => 'required',
        'failed_checkboxes' => 'required',
        'failed_inline_checkboxes' => 'required',
    ]);

    $validator->fails();
    Former::withErrors($validator);
@endphp

{!! Former::open()->method('GET') !!}
    {!! Former::checkbox('failed_checkbox')->text('Failed checkbox') !!}
    {!! Former::radio('failed_radio')->text('Failed radio') !!}
    {!! Former::checkbox('failed_inline_checkbox')->text('Failed inline checkbox')->inline() !!}
    {!! Former::radio('failed_inline_radio')->text('Failed inline radio')->inline() !!}
    {!! Former::checkboxes('failed_checkboxes')->checkboxes('first', 'second', 'third', 'fourth') !!}
    {!! Former::checkboxes('failed_inline_checkboxes')->checkboxes('first', 'second', 'third', 'fourth')->inline() !!}
{!! Former::close() !!}

And here the result:
former_checkables_invalid_feedback_bs4

Reference:
#581 (comment)

E.g.
{!! Former::open()->method('GET') !!}
    {!! Former::checkbox('test')->text('Test checkbox') !!}
{!! Former::close() !!}

Render:
<div class="form-check">
<input class="form-check-input" id="test" type="checkbox" name="test"
value="1">
  <label for="test" class="form-check-label">Test checkbox</label>
</div>

References:
- formers#581
- formers#590
E.g. with Laravel:
@php
    $validator = Validator::make(request()->all(), [
        'failed_checkbox' => 'required',
        'failed_radio' => 'required',
        'failed_inline_checkbox' => 'required',
        'failed_inline_radio' => 'required',
        'failed_checkboxes' => 'required',
        'failed_inline_checkboxes' => 'required',
    ]);

    $validator->fails();
    Former::withErrors($validator);
@endphp

{!! Former::open()->method('GET') !!}
    {!! Former::checkbox('failed_checkbox')->text('Failed checkbox') !!}
    {!! Former::radio('failed_radio')->text('Failed radio') !!}
{!! Former::checkbox('failed_inline_checkbox')->text('Failed inline
checkbox')->inline() !!}
{!! Former::radio('failed_inline_radio')->text('Failed inline
radio')->inline() !!}
{!! Former::checkboxes('failed_checkboxes')->checkboxes('first',
'second', 'third', 'fourth') !!}
{!!
Former::checkboxes('failed_inline_checkboxes')->checkboxes('first',
'second', 'third', 'fourth')->inline() !!}
{!! Former::close() !!}

Reference:
formers#581 (comment)
@tortuetorche tortuetorche changed the title Add missing 'form-check-label' CSS class for Bootstrap 4 Add missing 'form-check-label' class and fix invalid feedback for Bootstrap 4 Dec 30, 2020
@tortuetorche tortuetorche merged commit 264ea00 into formers:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant