Jitendra Vyas
Jitendra Vyas

Reputation: 152875

Is it necessary to have Submit button for each <form>?

If I'm using a dropdown using <select> is it ok. I'm asking in terms of Web Accessibility, Web Standards.

<form action="#" class="country-selection">
    <select>
        <option title="images/india.jpg">India</option>
        <option title="images/india.jpg">USA</option>
    </select>
</form>

Upvotes: 2

Views: 4893

Answers (5)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201866

Yes, because the page should work without client-side scripting too. The proper way is to include a real action attribute value, referring to a server-side script, and include a submit button, because that is the only way to ensure submittability when scripting is off. You can wrap it inside a noscript element so that it does not appear when it is not needed, i.e. when client-side scripting is enabled:

<noscript><input type=button value=Change></noscript>

The title attribute values may be displayed or otherwise presented to the user, so they should either contain something sensible (not URLs) or be absent. If you need to include some data for client-side processing, use data- attributes.

Upvotes: 3

Andrei G
Andrei G

Reputation: 1590

If you want to submit the form when the user makes a selection, try this

<form action="#" class="country-selection">

      <select onChange="javascript:submit()">

        <option title="images/india.jpg">India</option>

        <option title="images/india.jpg">USA</option>

      </select>

    </form>

Upvotes: 0

adeneo
adeneo

Reputation: 318342

Sure it's ok, noone is forcing a submit button on you, but you probably won't need an action on the form either.

Upvotes: 0

Shakti Singh
Shakti Singh

Reputation: 86476

If you don't have any submit button it is acceptable after all it is an element of form tag and if it is not required you may not add it with in form. This will not broke any web standard.

Upvotes: 1

Related Questions