Reputation: 152875
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
Reputation: 17743
No, that is specifically called out as a failure in WCAG 2.0: F37: Failure of Success Criterion 3.2.2 due to launching a new window without prior warning when the status of a radio button, check box or select list is changed.
Upvotes: 3
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
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
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
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