0

First of all I am new to this joomla CMS. I have a joomla project. here i have customized the userprofile plugin and added some more fields . in registration form i need an extra button named "Save for later ". thus my form contains 3 button ( save for later, Register and cancel )

i need to write a javascript function in the onclick event of "save for later button ".

So i have done

In components/com_user/views/registration/tpl/default.php I have created a button as in normal way. and wrote a javascript function call on this

<input  type="submit" class="validate" value="Save For Later" name="SaveDraft" onclick="fnSaveDraft()">

At the top of the page i write the function

<script language="javascript" type="text/javascript">
function fnSaveDraft() {
alert('hai');
return false;
}
</script>

But nothing happend

Please advise me

4

1 回答 1

1

我想建议你不要更改核心文件,除非你真的需要。你可以使用模板覆盖的方法来完成任务。有关详细信息,请访问该链接。 如何覆盖 Joomla 的输出!核心

对于您的问题,您正在使用输入类型,submit这就是您的表单将提交而您的函数未被调用的原因。您可以将类型用作按钮,然后您的任务将完成。用此替换您的输入字段。

<input  type="button" class="validate" value="Save For Later" name="SaveDraft" onclick="fnSaveDraft()">
于 2012-12-06T08:09:05.693 回答