[英]Java Script onclick multiple Validation
<html:submit
property = "buttonClicked"
styleClass = "buttonEnabled"
value = " Search"
onclick="this.form.submit(); this.disabled=true; this.value='Searching'"
onclick="return rfqValidation();"/>
This is my validation on the button click. 这是我对按钮单击的验证。 But only one validation is working. 但是只有一种验证有效。 If I give together it is Validating but after that form is submitting as I have given this.form.submit(). 如果我一起给出,则为Validating,但在提交该表单后,就像给出的this.form.submit()一样。 Any suggestion please so that both works with html:submit. 请提出任何建议,以使两者都可以与html:submit一起使用。
@Rajesh is right @Rajesh是正确的
or do it in a single onclick. 或一次点击即可完成。 I think you can not have multiple onclick in single tag. 我认为您不能在单个标记中包含多个onclick。
<html:submit
property = "buttonClicked"
styleClass = "buttonEnabled"
value = " Search"
onclick="this.form.submit(); this.disabled=true; this.value='Searching';return rfqValidation();"/>
The onclick property returns the click event handler code on the current element. onclick属性返回当前元素上的click事件处理程序代码。 source 资源
So, when you do the second onclick
assignment operation, a new anonymous function gets assigned to the onclick
property. 因此,当您执行第二次onclick
分配操作时,新的匿名函数将分配给onclick
属性。 So, you have to wrap them up in the same function call. 因此,您必须将它们包装在同一函数调用中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.