JP.dev
JP.dev

Reputation: 170

How can i have the form text empty?

I dont know the way to leave the the form text empty is there is no result.I need something like this.....

If there is no userCreator = form text empty

My code

<div class="col-md-4">
    <div class="form-group">
        {{ Form::label('userCreator','UserCreator') }}
        @if(isset($userCreator))
        @foreach($userCreator as $cs)
        {{ Form::text('userCreator',$cs->home_lastname,['class'=>'form-control']) }}
        @endforeach
        @else{ {{-- What should i put inside here ? --}}
        }
        @endif
    </div>
</div>

Upvotes: 0

Views: 49

Answers (2)

Dimitris Panagkasidis
Dimitris Panagkasidis

Reputation: 93

try this ...

<div class="col-md-4">
    <div class="form-group">
        {{ Form::label('userCreator','UserCreator') }}
        @if(!empty($userCreator))
          @foreach($userCreator as $cs)
            {{ Form::text('userCreator',$cs->home_lastname,['class'=>'form-control']) }}
          @endforeach
        @else
            {{ Form::text('userCreator','', ['class'=>'form-control']) }}
        @endif
    </div>
</div>

Upvotes: 1

Alexey Mezenin
Alexey Mezenin

Reputation: 163788

@if(isset($userCreator) && count($userCreator) > 0)
    <div class="col-md-4">
        <div class="form-group">
            {{ Form::label('userCreator','UserCreator') }}
            @foreach($userCreator as $cs)
            {{ Form::text('userCreator',$cs->home_lastname,['class'=>'form-control']) }}
            @endforeach
        </div>
    </div>
@endif

Upvotes: 2

Related Questions