我想爲Joomla開發我的第一個組件。我已經安裝了Joomla 3,而且事情很好。Joomla表單驗證缺少錯誤信息
我想在前端添加表單驗證(客戶端),我有一個提交表單。
我的代碼是:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Add form validation
JHTML::_('behavior.formvalidation');
?>
<form class="form-validate" id="myForm" method="post">
<input name="email" type="text" class="required validate-email" size="30" />
<button type="submit" class="validate">Submit form</button>
</form>
驗證工作,但不顯示任何信息的錯誤 - 只是一個場。錯誤字段的HTML爲:
<div id="system-message-container">
<div id="system-message" class="alert alert-error">
<h4 class="alert-heading"></h4>
<div></div>
</div>
</div>
那麼,如何向驗證中添加文本?我需要爲我的組件創建一個語言文件嗎?
上http://docs.joomla.org/Client-side_form_validation的文檔指出我需要使用
@ user2075107:您嘗試了我建議的內容嗎? – Irfan 2013-02-15 11:40:10
是的,我做到了。然後,表單甚至不會sumbit(我認爲這是一些jQuery錯誤)。如果我使用標記,那麼如果字段有效,則會提交表單。如果字段無效,則顯示「錯誤」div,但沒有任何內容(無文本) –
jensjel
2013-02-15 12:13:50