English 中文(简体)
j Query Validate on form submitted by Java
原标题:jQuery Validate on form submitted by JavaScript

我的表格是用贾瓦特文链接提交的,但我也试图证实从正义获得认可。 如果通过该链接提交,验证工作就没有工作,但如果我改变与提交纽州的联系,则会这样做。 我做了什么错误?

我的形式:

<form id="findmatch" method="post" action="search">
    <div>
        <label class="formlabel">Match Type
            <input type="text" name="matchtype" id="matchtype" class="forminput" />
        </label>

        <label class="formlabel">Location (postcode)
            <input type="text" name="location" id="location" class="forminput" />
        </label>

        <label class="formlabel">Radius (miles)
            <input type="text" name="Radius" id="Radius" class="forminput" />
        </label>

        <label class="formlabel">Keywords
            <input type="text" onblur="javascript:usePointFromPostcode(document.getElementById( location ).value, showCompleteLatLng)" onchange="javascript:usePointFromPostcode(document.getElementById( location ).value, showCompleteLatLng)" name="keywords" id="keywords" class="forminput" />
        </label>

        <input id="lat" class="hidden" name="lat" type="text" value="" />
        <input id="lon" class="hidden" name="lon" type="text" value="" />

        <a href="javascript:document.getElementById( findmatch ).submit();" onmouseover="javascript:usePointFromPostcode(document.getElementById( location ).value, showCompleteLatLng)" class="submit">Search</a>                        
    </div>
</form>

我的笑话

<script type="text/javascript">
    $(document).ready(function () {
        $("#findmatch").validate({
            rules: {
                location: "required",
                Radius: {
                    required: true,
                    digits: true
                },
                keywords: "required"
            },
            messages: {
                location: "Please enter your postcode",
                Radius: {
                    required: "Please enter a radius",
                    digits: "Please only enter numbers"
                },
                keywords: "Please enter the keywords you wish to search for"
            }
        });
    });
</script>
最佳回答

<DEMO:rel=“nofollow noreferer”> http://jsbin.com/urole/3

$(function () { 
  $( #提交 ).click(function(e) {
  e.preventDefault();
    $("#commentForm").提交(); 
  }); 
    $("#commentForm").validate();
});

提交

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签