【发布时间】:2013-02-15 13:52:44
【问题描述】:
如何使用 jQuery 在模糊上验证 joomla 默认文本编辑器?
这是我用来获取文本编辑器的代码。示例,在 /models/forms/newsitem.xml 中:
<field name="description" type="editor" buttons="true"
hide="pagebreak,readmore,article,image"
class="inputbox required"
filter="JComponentHelper::filterText"
label="JGLOBAL_DESCRIPTION"
description="COM_NEWSITEMS_FIELD_DESCRIPTION_DESC" required="true" />
还有第二个文件 (/views/.../edit.php) - 向 javascript 添加什么新对象?
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task == 'newsitem.cancel' || document.formvalidator.isValid(document.id('newsitem-form'))) {
<?php echo $this->form->getField('description')->save(); ?>
Joomla.submitform(task, document.getElementById('newsitem-form'));
} else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
</script>
我想要的是我想在文本编辑器旁边显示一条警告消息,说“你不能把这个留空”。我可以在表单提交中做到这一点,但真正的挑战是如何在模糊中做到这一点。
【问题讨论】:
标签: jquery joomla validation joomla2.5