我有一个简单的蛋糕php应用程序。当我尝试在表单中编辑我的数据时,一切都很好。除非我在表单中添加文本区域。当我添加文本时,表单不会发布数据并刷新自身。这就像是注意到了! 我禁用了我的所有javascript文件,但它没有帮助我也没有放置验证规则,但它也没有用。 这是我的控制器功能:
public function edit($id = null)
{
if (!$id) {
throw new NotFoundException(__('Invalid audit'));
}
$audit = $this->CreditAudit->findById($id);
if (!$audit) {
throw new NotFoundException(__('Invalid audit'));
}
if ($this->request->is('post') || $this->request->is('put')) {
$this->CreditAudit->id = $id;
if ($this->CreditAudit->save($this->request->data)) {
$this->Session->setFlash(__('Your audit has been updated.'));
return $this->redirect(array('action' => 'view'));
}
$this->Session->setFlash(__('Unable to update your audit.'));
}
if (!$this->request->data) {
$this->request->data = $audit;
}
}
以下是我的观点:
<?php
echo $this->Form->create('CreditAudit');
?>
<fieldset>
<legend><?php echo __('Product Purchase Plan'); ?></legend>
<table>
<tr>
<td>Credit Report Audit: Tri-Merge Credit Audit</td>
<td>Amt</td>
</tr>
<tr>
<td>
1 Payment of $50.00
<?php
//echo $this->Form->checkbox('Payment', array('hiddenField' => false));
?>
</td>
<td>$50</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo ('Contact Information'); ?></legend>
<?php echo $this->Form->input('first_name');
echo $this->Form->input('last_name');
echo $this->Form->input('cell',array('label'=>'Cell phone # (Numbers only!)'));
echo $this->Form->input('email');
echo $this->Form->input('birthday',array('label'=>'Birthday (MM/DD/YYYY)'));
echo $this->Form->input('SSN',array('label'=>'SSN (Numbers only!)'));
echo $this->Form->input('refferal',array('label'=>'Who reffered you to us?'));
echo $this->Form->input('notes',array('rows' => '3','name'=>'editor1','class'=>'ckeditor','type' => 'textarea','escape' => 'false','novalidate' => 'true'));
?></fieldset>
<fieldset>
<legend><?php echo 'Billing Address'; ?></legend>
<?php
echo $this->Form->input('street_adress_1');
echo $this->Form->input('street_adress_2');
echo $this->Form->input('city');
echo $this->Form->input('state');
echo $this->Form->input('postal_code',array('label'=>'Postal Code (Numbers only!)'));
?></fieldset>
<fieldset>
<legend><?php echo __('Credit Card Information'); ?></legend>
<?php
echo $this->Form->input('card_type',array('options'=>array('Visa'=>'Visa','Master card'=>'Master Card'),'empty'=>'Please select card type'));
echo $this->Form->input('card_number');
echo $this->Form->input('expiration_year',array('options'=>array('2013'=>'2013','2014','2015','2016','2017','2018','2019','2020','2021','2022','2023','2024','2025'),'empty'=>'Choose one'));
echo $this->Form->input('expiration_month',array('options'=>array('01'=>'01','02'=>'02','03'=>'03','04'=>'04','05'=>'05','06'=>'06','07'=>'07','08'=>'08','09'=>'09','10'=>'10','11'=>'11','12'=>'12'),'empty'=>'Choose one'));
echo $this->Form->input('cvc');
?></fieldset>
<?php
echo $this->Form->end('Update');
?>