1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <title>required and basic valueMissing
</title>
5 <script src=
"../../resources/js-test.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
10 <input id=
"input" name=
"victim" required
/>
11 <textarea id=
"textarea" name=
"victim" required
></textarea>
12 <select id=
"select-no-option" name=
"victim" required
>
14 <select id=
"select-placeholder-selected" name=
"victim" required
>
15 <option value=
"" selected
/>
16 <option value=
"X">X
</option>
18 <select id=
"select-without-placeholder" name=
"victim" required
>
19 <option value=
"X">X
</option>
20 <option value=
"" selected
/>
22 <select id=
"select-placeholder-selected-size2" name=
"victim" size=
"2" required
>
23 <option value=
"" selected
/>
24 <option value=
"X">X
</option>
26 <select id=
"select-without-placeholder-size2" name=
"victim" size=
"2" required
>
27 <option value=
"X">X
</option>
28 <option value=
"" selected
/>
30 <select id=
"select-none-selected-multiple" name=
"victim" multiple required
>
32 <option value=
"X">X
</option>
34 <select id=
"select-fake-placeholder-selected-multiple" name=
"victim" multiple required
>
35 <option value=
"" selected
/>
36 <option value=
"X">X
</option>
38 <select id=
"select-without-fake-placeholder-multiple" name=
"victim" multiple required
>
39 <option value=
"X">X
</option>
40 <option value=
"" selected
/>
42 <select id=
"select-none-selected-size2-multiple" name=
"victim" multiple
size=
"2" required
>
44 <option value=
"X">X
</option>
46 <select id=
"select-fake-placeholder-selected-size2-multiple" name=
"victim" multiple
size=
"2" required
>
47 <option value=
"" selected
/>
48 <option value=
"X">X
</option>
50 <select id=
"select-without-fake-placeholder-size2-multiple" name=
"victim" multiple
size=
"2" required
>
51 <option value=
"X">X
</option>
52 <option value=
"" selected
/>
54 <select id=
"select-optgroup" name=
"victim" required
>
56 <option value=
"" selected
/>
58 <option value=
"X">X
</option>
60 <select id=
"select-disabled-option" name=
"victim" required
>
61 <option value=
"" disabled selected
/>
62 <option value=
"X">X
</option>
64 <select id=
"select-disabled-option-2" name=
"victim" required
>
65 <option value=
"" disabled
/>
66 <option value=
"X">X
</option>
68 <script language=
"JavaScript" type=
"text/javascript">
69 function valueMissingFor(id
) {
70 return document
.getElementById(id
).validity
.valueMissing
;
73 description("This test checks validity.valueMissing with blank values, blank options selected, or nothing selected.");
75 v
= document
.getElementsByName("victim");
77 shouldBeTrue('valueMissingFor("input")');
78 shouldBeTrue('valueMissingFor("textarea")');
79 shouldBeTrue('valueMissingFor("select-no-option")');
80 shouldBeTrue('valueMissingFor("select-placeholder-selected")');
81 shouldBeFalse('valueMissingFor("select-without-placeholder")');
82 shouldBeFalse('valueMissingFor("select-placeholder-selected-size2")');
83 shouldBeFalse('valueMissingFor("select-without-placeholder-size2")');
84 shouldBeTrue('valueMissingFor("select-none-selected-multiple")');
85 shouldBeFalse('valueMissingFor("select-fake-placeholder-selected-multiple")');
86 shouldBeFalse('valueMissingFor("select-without-fake-placeholder-multiple")');
87 shouldBeTrue('valueMissingFor("select-none-selected-size2-multiple")');
88 shouldBeFalse('valueMissingFor("select-fake-placeholder-selected-size2-multiple")');
89 shouldBeFalse('valueMissingFor("select-without-fake-placeholder-size2-multiple")');
90 shouldBeFalse('valueMissingFor("select-optgroup")');
91 shouldBeTrue('valueMissingFor("select-disabled-option")');
92 shouldBeFalse('valueMissingFor("select-disabled-option-2")');
93 shouldBe('document.getElementById("select-disabled-option-2").selectedIndex', '1');