我在twitter bootstrap中使用cakephp。我称一个模态显示一个从数据库中填充的表单。表单显示正常,但提交按钮在de modal中没有响应。如果我将页面调用直接加载到模态中,则表单可以正常工作。我在同一页面上还有一个其他模态,没有任何问题。不同之处在于工作模式是在html中预定义的,并且给出问题的模态加载了一个url。他们都有不同的身份。我认为这个问题很简单,但我无法弄清楚它是什么。她的一些代码
控制器:
public function modal($id = null) {
//$this->loadModel('EditorderForm');
if (empty($this->request->data)) {
$this->layout = 'modal';
$this->Bestelling->setSource('bestelling');//Sets the database to work wit
$orderedit = $this->Bestelling->findById($id);
if (!$orderedit) {
throw new NotFoundException(__('No orders found'));
}
$this->set('orderedit', $orderedit);
} else {
// Save logic goes here
}
}
查看:
echo $this->Form->create('Bestelling');
包含数据的某些字段(表单字段)
echo $this->Form->button('Save Changes', array('class' => 'btn btn-primary'));
echo $this->Form->end();
输出(仅表格)
<form action="/bestelling/modal/62172" id="BestellingModalForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div><div class="input tel required"><label for="BestellingBestelnummer">Bestelnummer</label><input name="data[Bestelling][bestelnummer]" class="input-small" value="55964" type="tel" id="BestellingBestelnummer" required="required"/></div><div class="input tel required"><label for="BestellingKlantnummer">Klantnummer</label><input name="data[Bestelling][klantnummer]" class="input-small" value="1005" type="tel" id="BestellingKlantnummer" required="required"/></div> </div>
<div class="span4">
<br/>
<input type="hidden" name="data[Bestelling][serial]" id="BestellingSerial_" value="0"/><input type="checkbox" name="data[Bestelling][serial]" value="1" id="BestellingSerial"/> <span class="label label-info">Serialcode</span> <br/>
<input type="hidden" name="data[Bestelling][insured]" id="BestellingInsured_" value="0"/><input type="checkbox" name="data[Bestelling][insured]" value="1" id="BestellingInsured"/> <span class="label label-info">Insured</span> <br/>
<input type="hidden" name="data[Bestelling][giftpaper]" id="BestellingGiftpaper_" value="0"/><input type="checkbox" name="data[Bestelling][giftpaper]" value="1" id="BestellingGiftpaper"/> <span class="label label-info">Giftpaper</span> </div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="input tel required"><label for="discription">Titel</label><input name="data[Bestelling][titel]" class="span10" id="discription" value="X360 NBA 2K12" type="tel" required="required"/></div> </div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="input textarea"><label for="BestellingOpmerking">Opmerking</label><textarea name="data[Bestelling][opmerking]" class="span10" rows="4" cols="90" id="BestellingOpmerking">test''</textarea></div> </div>
</div>
<button class="btn btn-primary" type="submit">Save Changes</button></form>
</div>