Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Form and Html using Laravel 4.x:

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 183
    Comment on it

    As we all know that in each and every framework and project we will use form and html.Similarly by using Laravel 4.x we will create form and use html.

     

    Opening A Form:

    For opening a form in laravel 4.x the following syntax is used:

     

    {{ Form::open(array('url' => 'foo/bar')) }}
        //
    {{ Form::close() }}

     

    Here we can see that In above example one form is open and close and In between we will create form fields which we want to create. By default a form can take a post method and we can also create another method in Laravel such as post,get,pull,delete.

    We may also open forms that point to named routes or controller actions:

     

    echo Form::open(array('route' => 'route.name'))
    
    echo Form::open(array('action' => 'Controller@method'))

     

    Example:

    So by using example I will clear how we will make form in laravel 4.x.

     

    <div class="col-md-12 col-sm-11 col-xs-12 centralize searchPanel pdding0">
        <div class="col-xs-1 seargroupcati">
            <span class="glyphicon glyphicon-user" id="displayGroupIcon"></span>
            <i class="glyphicon glyphicon-chevron-down"></i>
        </div>
        {{ Form::open(array('id' => 'groupSearchFrm' ,'url' => '' , 'method' => 'post')) }} 
        <div class="col-sm-10 col-xs-9">
            {{ Form::text('searchGroup',$searchGroupVal,array('class'=>'form-control searchBox searchBox-sphere','placeholder' => 'Search for a name', 'id'=> 'searchGroupKeyword', 'autocomplete'=>'off')); }}
        {{ Form::hidden('searchGroupOption',$searchGroupOption ,array('id'=>'searchGroupOption')); }}
        {{ Form::hidden('GroupChoosen',$groupId ,array('id'=>'GroupChoosen')); }}
        </div>
        <div class="col-xs-1 pull-right searchIconbtn border-left">
             {{Form::submit('',array('class'=>'searchBTN', 'id'=>'groupsubmit'));}}  
        </div>
         {{ Form::close() }} 
    </div>

     

    Here In the above example we can see we have open the form and define the method post and make fields according to the need.

    By this we can create form using Laravel 4.x.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: