У меня есть файл admin_form.ctp. Когда я отправляю его с пустыми данными, то проверка корректности торта работает правильно, но проблема в том, что макет формы меняется и URL-адрес одинаковый. Я имею в виду, что все проверки и URL страницы верны, но макет страницы изменился.Ошибка проверки достоверности на разных макетах в cakephp 2.0?
Если у любого органа есть предложение, пожалуйста, сообщите мне как можно скорее. Спасибо.
admin_form.ctp код
<?php echo $this->Form->create('Page');
echo $this->Form->input('id');
?>
<div>
<?php echo $this->Form->input('title',array('onblur' => "MetaTitle()",'class'=>'sprited')); ?>
</div>
<div>
<?php echo $this->Form->input('alias',array('class'=>'sprited')); ?>
</div>
<div>
<?php echo $this->Form->input('description',array('type' => 'textarea' , 'class' => 'ckeditor sprited')); ?>
</div>
<div>
<?php echo $this->Form->input('meta_title',array('class'=>'sprited')); ?>
</div>
<div>
<?php echo $this->Form->input('meta_keyword',array('class'=>'sprited')); ?>
</div>
<div>
<?php echo $this->Form->input('meta_description',array('class'=>'sprited')); ?>
</div>
<div class="status">
<?php echo $this->Form->input('status',array('class'=>'sprited')); ?>
</div>
<div class="clear"></div>
<div id="actions">
<input type="submit" class="save" value="Save" />
<?php
echo $this->Html->link(__('Cancel'), array(
'action' => 'index',
), array(
'class' => 'cancel',
));
?>
Контроллер: -
public function admin_add() {
$this->layout = 'admin';
$this->set('title_for_layout', __('Add new page', true));
if (!empty($this->request->data)) {
$this->Page->create();
$this->request->data['Page']['user_id'] = $this->Auth->User('id');
if($this->data['Page']['alias']==""){
$this->request->data['Page']['alias']=$this->data['Page']['title'];
}
$this->request->data['Page']['alias'] = $this->title_to_alias(trim($this->data['Page']['alias']));
if ($this->Page->save($this->request->data)) {
$this->Session->setFlash(__('The page has been saved.'), 'default', array('class' => 'success'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The page could not be saved. Please, try again.'), 'default', array('class' => 'error'));
}
}
$this->render('admin_form');
}
1. Является ли эта форма отправкой действию стороны администратора? в противном случае. Отправьте свой код .. чтобы мы могли отслеживать. – AnNaMaLaI
Да, форма отправляется в действие стороны администратора. –
может у вас отправить urt код ctp и код контроллера? – AnNaMaLaI