php - Codeigniter 3.x / form_input() / preappend or append / bootstrap 3.x -


how is possible include prepend icon or append icon using form_input();

<?php                              $email = array(          'name'        => '',          'value'       => '',          'id'          => null,             'placeholder' => 'email',          'class'       => 'mail form-control'          );  echo form_input($email); ?> 

what add, example, following bootstrap 3 styling email input box:

<span class="input-group-addon" id="basic-addon2">@example.com</span> 

i unsure how fit array. have looked @ manual ci3, however, not mention in particular. suggestions, etc, appreciated.

this aiming for:

enter image description here

taking code bootstrap website:

<form class="form-horizontal">   <div class="form-group has-success has-feedback">     <label class="control-label col-sm-3" for="inputsuccess3">input success</label>     <div class="col-sm-9">       <input type="text" class="form-control" id="inputsuccess3" aria-describedby="inputsuccess3status">       <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>       <span id="inputsuccess3status" class="sr-only">(success)</span>     </div>   </div>   <div class="form-group has-success has-feedback">     <label class="control-label col-sm-3" for="inputgroupsuccess2">input group success</label>     <div class="col-sm-9">       <div class="input-group">         <span class="input-group-addon">@</span>         <?php                                      $email = array(             'type'        => 'text',             'class'       => 'form-control'             'id'          => 'inputgroupsuccess2',             'aria-describedby' => 'inputgroupsuccess2status',             'name'        => 'email',//name field mandatory able control in form_validation library             'placeholder' => 'email',         );          echo form_input($email);         ?>       </div>       <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>       <span id="inputgroupsuccess2status" class="sr-only">(success)</span>     </div>   </div> </form> 

you can see span tag , input tag doesn't collide. use:

<?php                              $email = array(     'name'        => '',     'value'       => '',     'id'          => null,        'placeholder' => 'email',     'class'       => 'mail form-control' );  echo form_input($email); ?> 

instead of bootstrap input field. else can stay same in view file. if make input field second 1 example above, should code like:

<?php                              $email = array(     'type'        => 'text',     'class'       => 'form-control'     'id'          => 'inputgroupsuccess2',     'aria-describedby' => 'inputgroupsuccess2status',     'name'        => 'email',//name field mandatory able control in form_validation library     'placeholder' => 'email', );  echo form_input($email); ?> 

this example "optional icons in horizontal , inline forms" on forms page.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -