我有这个表单,但提交按钮似乎没有响应。
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
<version>1.1.0-alpha-SNAPSHOT</version>
</dependency>
答案 0 :(得分:1)
使用按钮代替链接。
<button type="reset" class="button-2">Clear</button>
<button type="submit" class="button-2">Send</button>
答案 1 :(得分:1)
而不是锚标记:
<a class="button-2" href="#">Clear</a>
<a class="button-2" href="exec.php">Send</a>
使用以下按钮标记:
<button type="reset" class="button-2">Reset</button>
<button type="submit" class="button-2">Send</button>
答案 2 :(得分:0)
<script type="text/javascript">
//<![CDATA[
function get_form( element )
{
while( element )
{
element = element.parentNode
if( element.tagName.toLowerCase() == "form" )
{
//alert( element ) //debug/test
return element
}
}
return 0; //error: no form found in ancestors
}
//]]>
</script>
<form name="form" id="contact-form" action="exec.php" method="post" enctype="multipart/form-data">
<fieldset>
<label><span class="text-form">Name:</span>
<input name="p1" type="text" />
</label>
<label><span class="text-form">Email:</span>
<input name="p2" type="text" />
</label>
<div class="wrapper">
<div class="text-form">Message:</div>
<textarea></textarea>
</div>
<div class="buttons">
<a class="button-2" href="#">Clear</a>
<a class="button-2" onclick="get_form(this).submit(); return false">Send</a> </div>
</fieldset>
</form>
答案 3 :(得分:0)
<a href="#" class="button-2" onclick="$(this).closest('form').submit(); return false;">Send</a>
答案 4 :(得分:-1)
使用以下代码明确提交表单:
<a class="button-2" href="exec.php" onclick ="javascript:this.submit();">Send</a>