Form will not submit

2019-05-19 02:39发布

问题:

I have a form on my jquery-mobile/modernizr site. I'm using 1.1.0-rc.1 of jquery-mobile. I have this form on my page, and it does not submit. Clicking the search button does absolutely nothing. I don't know why. Any ideas?

<p data-enhance="false">
            <form action="/Home/Search" method="get">
    <ul data-role="listview" data-inset="true">
        <li data-role="list-divider">Search</li>
        <li>
            <div class="ui-grid-a">
                    <div class="ui-block-a" style="vertical-align: middle;">
                    <input id="Query" name="Query" type="text" value="" />
                </div>
                <div class="ui-block-b" style="vertical-align: middle; max-width: 150px;">
                    <input data-ajax="false" data-icon="search" type="submit" value="Search" data-role="button" data-mini="true" style="vertical-align: middle;" />
                </div>
            </div>
        </li>
    </ul>
            </form>  
</p>

回答1:

As @supertopi suggests, its not recommended to have your form inside of a p tag.

See this excellent post describing the problem in detail: Why doesn't form nested in p validate as XHTML

Maybe you could post more code or check your error log? The HTML above does work in jsfiddle.net - http://jsfiddle.net/shanabus/5V9sn/



回答2:

Without seeing further into your application logic it is hard to tell but possibly change your form to

<form action="#/Home/Search" method="get">