I've two questions about bootstrap nav tabs in Laravel (I use material design). When I click on a tab I want to make the class active so it lights up. In my menu I'm doing that like this:
<li class="{!! Request::is('createticket') ? 'active' : '' !!}"><a href="/createticket">Maak Ticket</a></li>
But I can't do that now because it doesn't make a request. This is my code:
@extends('standaard.master')
@section('name', 'Profiel')
@section('content')
<div class="container col-md-8 col-md-offset-2">
<div class="well well bs-component">
<ul class="nav nav-tabs" style="margin-bottom: 15px;">
<li class="active"><a href="#gegevens" data-toggle="tab">Gegevens</a></li>
<li><a href="#onderhoudscontract" data-toggle="tab">Onderhoudscontract</a></li>
<li><a href="#wachtwoord" data-toggle="tab">Wachtwoord aanpassen</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="gegevens">
<form class="form-horizontal" method="post">
@if(Request::is('profile'))
@foreach ($errors->all() as $error)
<p class="alert alert-danger"></p>
@endforeach
@endif
@if (session('status'))
<div class="alert alert-success">
</div>
@endif
{!! csrf_field() !!}
<fieldset>
<legend>Gegevens</legend>
<div class="form-group">
<label for="name" class="col-lg-2 control-label">Naam</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="name" placeholder="Naam" name="name" value="{!! ucfirst(Auth::User()->name) !!}">
</div>
</div>
<div class="form-group">
<label for="name" class="col-lg-2 control-label">Achternaam</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="lastname" placeholder="Achternaam" name="lastname" value="{!! ucfirst(Auth::User()->lastname) !!}">
</div>
</div>
<div class="form-group">
<label for="email" class="col-lg-2 control-label">Email</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="disabledInput" placeholder="Email" disabled="" value="{!! ucfirst(Auth::User()->email) !!}">
</div>
</div>
<div class="form-group">
<label for="company" class="col-lg-2 control-label">Bedrijf</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="disabledInput" placeholder="Email" disabled="" value="{!! ucfirst(Auth::User()->company) !!}">
</div>
</div>
<div class="form-group">
<label for="company" class="col-lg-2 control-label">Adres</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="adres" placeholder="Adres" name="adres" value="{!! ucfirst(Auth::User()->adres) !!}">
</div>
</div>
<div class="form-group">
<label for="company" class="col-lg-2 control-label">Postcode</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="zip" placeholder="Postcode" name="zip" value="{!! ucfirst(Auth::User()->zip) !!}">
</div>
</div>
<div class="form-group">
<label for="company" class="col-lg-2 control-label">Woonplaats</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="city" placeholder="Woonplaats" name="city" value="{!! ucfirst(Auth::User()->city) !!}">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Annuleer</button>
<button type="submit" class="btn btn-primary">Update profielgegevens </button>
</div>
</div>
</fieldset>
</form>
</div>
<div class="tab-pane fade" id="onderhoudscontract">
<legend>Onderhoudscontract(en)</legend>
@if(Auth::user()->websites->isEmpty())
<p>U heeft momenteel nog geen onderhoudscontract(en).</p>
@else
@foreach(Auth::user()->websites as $onderhoudscontract)
<div id="onderhoudscontractbackground">
<strong>Domein: </strong><p>{!! $onderhoudscontract->name !!}</p>
<strong>Pakket: </strong><p>{!! $onderhoudscontract->subscription->name !!}</p>
<strong>Maandelijkse betaling:</strong><p>{!! $onderhoudscontract->subscriptionstate->name !!}</p>
</div>
@endforeach
@endif
<button class="btn btn-primary">Vragen?</button>
</div>
<div class="tab-pane fade" id="wachtwoord">
<form class="form-horizontal" method="post" action="/savepassword">
@if(Request::is('/savepassword'))
@foreach ($errors->all() as $error)
<p class="alert alert-danger"></p>
@endforeach
@endif
@if (session('wachtwoordaangepast'))
<div class="alert alert-success">
</div>
@endif
{!! csrf_field() !!}
<fieldset>
<legend>Wijzig uw wachtwoord</legend>
<div class="form-group">
<label for="password" class="col-lg-2 control-label">Wachtwoord</label>
<div class="col-lg-10">
<input type="password" class="form-control" id="password" placeholder="wachtwoord" name="password">
</div>
</div>
<div class="form-group">
<label for="password" class="col-lg-2 control-label">Bevestig</label>
<div class="col-lg-10">
<input type="password" class="form-control" placeholder="Bevestig wachtwoord"name="password_confirmation">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Annuleer</button>
<button type="submit" class="btn btn-primary">Verander</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
@endsection
My second question is that I've two request in this so it validates 2 different forms. But when I Submit one form it shows the $errors also in the other form. I tried to fix it with:
@if(Request::is('profile'))
@foreach ($errors->all() as $error)
<p class="alert alert-danger"></p>
@endforeach
@endif
But that's not working.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1N0ScaR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire