2
我正在更新我的zend項目中的表單,這是非常基本的。更新表格以使用<button type="submit">
標籤後,它不會發布表單。在Zend表格不提交<button>提交類型只提交與<input>
不工作 <button type="submit" name="Save">Continue</button>
作品<input type="submit" name="Save" value="Next">
中拋出下面的錯誤是,爲什麼$value = trim($value);
顯示了空控制器代碼的一部分,當我張貼的形式?我的所有字段和表單操作都是正確的我已經測試了所有內容,並且它歸結爲提交按鈕類型是問題。由於
$userSess = new Zend_Session_Namespace('Default');
if (!$this->getRequest()->isPost()) {
$this->_helper->redirector('index','welcome');
}
$postData = $this->_request->getPost();
//validating form data, if empty data comes, redirect with err msg
foreach($postData as $key => $value) {
$value = trim($value);
if($value == "") //if empty field submitted, redirect back with invalid msg
$this->_helper->redirector('index','welcome',null,array('err'=>'Please Fill in all details'));
}
謝謝你的工作。我認爲輸入中的值只是被使用,因爲它是一個「輸入」值與「按鈕」,它們之間的值設置在標籤之間。代碼所尋找的值是表單中每個字段的數據。 – Anagio
與此無關,如果省略值,文本內容將用作值(+更老的IE根本不使用值屬性) – pozs