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 container #57

Closed razzzo closed 9 years ago

razzzo commented 9 years ago

Hey,

Is there any specific reason for omitting {hint} tag in buildTemplate() method?

buildLayoutParts() and then setLayoutContainer('hint', $errorDivClass); prepares container for hint as follows (or similar)

<div class=\'col-md-offset-2 col-md-6\'>{hint}</div>

but it is not applied and I'm getting something like hint_1

After small update in ActiveField::buildTemplate()

protected function buildTemplate()
    {
        ...
        $this->template = strtr($this->template, [
            '{label}' => $showLabels ? "{$this->contentBeforeLabel}{label}{$this->contentAfterLabel}" : '',
            '{input}' => str_replace(
                '{input}',
                $this->contentBeforeInput . $this->generateAddon() . $this->renderFeedbackIcon() . $this->contentAfterInput,
                $input
            ),
            '{error}' => $showErrors ? str_replace(
                '{error}',
                "{$this->contentBeforeError}{error}{$this->contentAfterError}",
                $error
            ) : '',
            // UPDATE
            '{hint}' => str_replace('{hint}', "{hint}", $hint)
        ]);
    }

I'm getting hint with applied container hint_2

I use ActiveForm::TYPE_HORIZONTAL form

kartik-v commented 9 years ago

Will need to check. This was changed a bit in #22 for an update in core yii active field rendering active hints differently.

Will check and update.

razzzo commented 9 years ago

Ok, thanks.

kartik-v commented 9 years ago

I cannot reproduce this... it seems to render fine.

Ensure you have the latest updated version / release of the extension.

razzzo commented 9 years ago

You're right, it's fine. I use class ActiveField extends \kartik\form\ActiveField. I did some modifications in my ActiveField::render() and that was the problem.

kartik-v commented 9 years ago

Yes if you are extending classes... please test with core extension inbuilt classes before reporting issues.