kartik-v / yii2-widgets

Collection of useful widgets for Yii Framework 2.0
http://demos.krajee.com/widgets
Other
558 stars 175 forks source link

How to display error div just after "form-group" class #377

Closed rupalgohel closed 5 years ago

rupalgohel commented 5 years ago

How can shif error p tag just after form-group

<div class="col-sm-6">
     <div class="form-group field-signupform-value1 required">
          <label class="control-label" for="signupform-value1">value1 Name</label>
          <input type="text" id="signupform-value1" class="form-control" name="SignupForm[value1]" placeholder="value1 Name" aria-required="true">
           <p class="help-block help-block-error"></p>
      </div> 
</div>

<div class="col-sm-6">
     <div class="form-group field-signupform-value1 required">
          <label class="control-label" for="signupform-value1">value1 Name</label>
          <input type="text" id="signupform-value1" class="form-control" name="SignupForm[value1]" placeholder="value1 Name" aria-required="true"> 
      </div> 
    <p class="help-block help-block-error"></p> 
</div>
rupalgohel commented 5 years ago

I achieved by below code.


<?php 
$form = ActiveForm::begin([
    'fieldConfig'=>['template'=>' <div class="custom"> 
    {label}{input}
</div>
{error}',
'inputOptions' => [
'placeholder' => 'Username ...',
'class'=>'form-control',
]]
 ]); ?>

and given css to "custom" class for border-box