cakephp-plugin-boost_cake icon indicating copy to clipboard operation
cakephp-plugin-boost_cake copied to clipboard

`has-error` class not work in CakePHP2.9 + Bootstrap3.3.7

Open bties-ogawa opened this issue 8 years ago • 0 comments

Hi, this plugin is very cool.

I encounted a trouble that parent div class don't add class 'has-error'.

AppController.php

public $helpers = [
	'Session',
	'Html' => [
		'className' => 'BoostCake.BoostCakeHtml'
	],
	'Form' => [
		'className' => 'BoostCake.BoostCakeForm'
	],
	'Paginator' => [
		'className' => 'BoostCake.BoostCakePaginator'
	],
];

UserController.php

public function add() {
	if ($this->request->is('post')) {
		$this->User->create();
		if ($this->User->save($this->request->data)) {
			return $this->redirect(array('action' => 'index'));
		}
	}
}

View/User/add.ctp

<div class="row">
	<div class="col-sm-12">

		<?php echo $this->Form->create('User', [
			'url' => '/users/add',
			'class' => 'form-horizontal',
			'novalidate' => true,
		]);?>

		<div class="form-group">
			<label for="UserUsername" class="col-sm-2 control-label">Email</label>
			<div class="col-sm-10">
				<?php echo $this->Form->input('username', ['type' => 'text', 'div' => false, 'label' => false, 'class' => 'form-control', 'required' => false])?>
			</div>
		</div>

result

		<div class="form-group">
			<label for="UserUsername" class="col-sm-2 control-label">メールアドレス</label>
			<div class="col-sm-10">
				<div class="input text required"><input name="data[User][username]" class="form-control form-error" maxlength="50" type="text" value="" id="UserUsername"/><span class="help-block text-danger">Input email address!!</span></div>
			</div>
		</div>

My expect be add class ''has-error' in 'div.form-group'.

		<div class="form-group has-error">
			<label for="UserUsername" class="col-sm-2 control-label">メールアドレス</label>
			<div class="col-sm-10">
				<div class="input text required"><input name="data[User][username]" class="form-control form-error" maxlength="50" type="text" value="" id="UserUsername"/><span class="help-block text-danger">Input email address!!</span></div>
			</div>
		</div>

What causes can be considered?

bties-ogawa avatar Oct 26 '17 08:10 bties-ogawa