jeudi 28 février 2019

Laravel: can't check checkbox

why can't I check this checkbox when I run my code? + how can i do error handling on the checkbox. It needs to be checked before submitting

checkbox code:

<div class="o-grid__col u-12/12">
            <div class="o-grid__col u-12/12@sm">
                {!! Form::checkbox('contact_prerequisite', 'contact_prerequisite', ['class' => 'c-input__checkbox required','id' => 'agree_toc','required']) !!}
                {!! Form::label('contact_prerequisite', __('profile.contactPrerequisite'),['class' => 'c-input__checkboxLabel p2','for' => 'agree_toc']) !!}
            </div>
        </div>

full code:

{!! Form::model($profile,['route' => ['profile.sendmail',$profile->id],'method' => 'POST']) !!}
<div class="events single-event">
    <div class="o-grid">
        <div class="o-grid__col u-6/12">
            <div class="o-grid__col u-12/12@sm">
                <h4>@lang('profile.contactTitle')</h4>
            </div>
            <div class="o-grid__col u-12/12@sm">
                {!! Form::label('', __('profile.contactSalutation').'*') !!}
                @if( Session::get('urlLang') == "en" )
                    {!! Form::select(__('contact_contactSalutation'), array('Miss' => 'Miss', 'Sir' => 'Sir'),array('class' => 'c-dropdown c-dropdown__simple u-mb-x6'),['required' => 'required']) !!}
                @else
                    {!! Form::select(__('contact_contactSalutation'), array('Frau' => 'Frau', 'Herr' => 'Herr'),array('class' => 'c-dropdown c-dropdown__simple u-mb-x6'),['required' => 'required']) !!}
                @endif
            </div>
            <br>
        </div>
        <div class="o-grid__col u-6/12">
            <div class="o-grid__col u-12/12@sm">
                <p style="color: #696978; font-size: 14px; text-align: right">@lang('profile.mandatoryField')</p>
            </div>
        </div>
    </div>
    <div class="o-grid">
        <div class="o-grid__col u-6/12">
            <div class="o-grid__col u-12/12@sm">
                {!! Form::label('contact_first_name', __('profile.contactFirstName').'*') !!}
                {!! Form::text('contact_first_name', null, ['placeholder' => __('profile.contactFirstName'),'class' => 'c-input required','id' => 'contact_first_name','required']) !!}
            </div>
            <div class="o-grid__col u-12/12@sm">
                {!! Form::label('contact_e_mail', __('profile.contactEmail').'*') !!}
                {!! Form::text('contact_e_mail', null, ['placeholder' => __('profile.contactEmail'),'class' => 'c-input required email','id' => 'contact_e_mail','required']) !!}
            </div>
        </div>
        <div class="o-grid__col u-6/12">
            <div class="o-grid__col u-12/12@sm">
                {!! Form::label('contact_last_name', __('profile.contactLastName').'*') !!}
                {!! Form::text('contact_last_name', null, ['placeholder' => __('profile.contactLastName'),'class' => 'c-input required','id' => 'contact_last_name','required']) !!}
            </div>
            <div class="o-grid__col u-12/12@sm">
                {!! Form::label('contact_phone', __('profile.contactPhone')) !!}
                {!! Form::text('contact_phone', null, ['placeholder' => __('profile.contactPhone'),'class' => 'c-input','id' => 'contact_phone']) !!}
            </div>
        </div>

        <div class="o-grid__col u-12/12">
            <div class="o-grid__col">
                {!! Form::label('text', __('profile.contactMessageInfo')) !!}
                {!! Form::textarea('contact_text',null,['class' => 'c-input c-input__text required','placeholder' => __('profile.contactMessageInfo'),'id' => 'contact_text','required']) !!}
            </div>
        </div>

        <div class="o-grid__col u-12/12">
            <div class="o-grid__col u-12/12@sm">
                {!! Form::checkbox('contact_prerequisite', 'contact_prerequisite', ['class' => 'c-input__checkbox required','id' => 'agree_toc','required']) !!}
                {!! Form::label('contact_prerequisite', __('profile.contactPrerequisite'),['class' => 'c-input__checkboxLabel p2','for' => 'agree_toc']) !!}
            </div>
        </div>
        <div class="o-grid__col u-text-right">
            <button id="submit" class="c-btn c-btn--small c-btn--red" type="submit">
                <span>@lang('profile.contactSendMessage')</span></button>
        </div>
    </div>
</div>






Aucun commentaire:

Enregistrer un commentaire