kartik-v / yii2-widget-activeform

Enhanced Yii2 active-form and active-field with full bootstrap styling support (sub repo split from yii2-widgets).
http://demos.krajee.com/widget-details/active-form
Other
64 stars 35 forks source link

hint() method is printing to wrong div #54

Closed halfahad closed 9 years ago

halfahad commented 9 years ago

ActiveField->hint() is printing out to the help-block div and not the hint-block div, as it should.

kartik-v commented 9 years ago

How are you trying to configure your widget?

The hint works fine within hint block - as can be seen in the demo.

NOTE: You must have the latest dev release from yii...

halfahad commented 9 years ago

I was on the latest stable release. Furthermore you may check your demo here: link to HTML5 Demo Page!

echo $form->field($model, 'image')->
    input('color', ['style' => 'width: 50px; cursor: pointer;'])->
    hint('Color picker input. Supported on Firefox, Chrome, and Opera.');

is outputting the following html

<div class="form-group field-demo-image">
    <input type="color" id="demo-image" class="form-control" name="Demo[image]">
    <div class="help-block"></div>
    <div class="hint-block">Color picker input (default). Supported on Firefox, Chrome, and Opera.   </div>
</div>

This is only for the latest stable version, I have not delved into the dev release.

Thanks for your hard work.

halfahad commented 9 years ago

I just realized its printing to the right div. sorry about that.

I was confused about the difference between

yii/widgets/activeform output

<label class="control-label" for="product-name">Name</label>
<input type="text" id="product-name" class="form-control" name="Product[name]" value="Name" maxlength="120">
<div class="hint-block">This is the hint</div>
<div class="help-block"></div>

kartik/widgets/activeform output:

<label class="control-label" for="product-name">Name</label>
<input type="text" id="product-name" class="form-control" name="Product[name]" value="Hikvision 720TVL Dome Camera" maxlength="120">
<div class="help-block"></div>
<div class="hint-block">This is the hint</div>

the hint and help blocks are switched. Maybe it was intended on your design.

thanks again!