Fixit – Provide defaults

When you have a form on your page you should include preset defaults. Doing this may reduced the amount of input the user may have to enter, thus providing a better user-experience. This test checks that you have provided defaults in your form elements where appropriate. The test is not run if the page does not contain a form.

Providing defaults

To pass this test you should check that all radio buttons and select menus have a default value selected

Radio buttons

To provide a default value for a set of radio buttons, you use the checked attribute with the desired default radio control element. An example is given below:

Note that both radio controls have the same name, that is how they are associated, but only one has the checked=checked attribute.

Note that in HTML it is permitted to use the attribute checked without an assignment. However, this is not allowed in XHTML, hence you must use checked="checked"

Incorrect:

Correct:

Select menus

To provide a default value in a select menu, you use the selected attribute with the desired default option element of the menu. An example is given below:

Note that in HTML it is permitted to use the attribute selected without an assignment. This is not allowed in XHTML, so you must use selected="selected":

Incorrect:

Correct:

 

Reference

This test is based on a W3C mobileOK best practise test. See http://www.w3.org/TR/mobile-bp/#PROVIDE_DEFAULTS for more details

 

Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Market leading device intelligence for the web, app and MNO ecosystems
DeviceAtlas - Device Intelligence

Real-time identification of fraudulent and misrepresented traffic
DeviceAssure - Device Verification

A free tool for developers, designers and marketers to test website performance
mobiReady - Evaluate your websites’ mobile readiness

© 2025 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland