| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <title>required attribute JS set</title> |
| <script src="../../resources/js-test-pre.js"></script> |
| <input id="input" name="victim" /> |
| <textarea id="textarea" name="victim"></textarea> |
| <select id="select" name="victim"> |
| <option value="" selected /> |
| <option value="X">X</option> |
| <script language="JavaScript" type="text/javascript"> |
| function requiredFor(id) { |
| return document.getElementById(id).required; |
| description("There are three form control elements below, all optional. They're set as required via required DOM attribute."); |
| v = document.getElementsByName("victim"); |
| shouldBeFalse('requiredFor("input")'); |
| shouldBeFalse('requiredFor("textarea")'); |
| shouldBeFalse('requiredFor("select")'); |
| shouldBeTrue('requiredFor("input")'); |
| shouldBeTrue('requiredFor("textarea")'); |
| shouldBeTrue('requiredFor("select")'); |
| <script src="../../resources/js-test-post.js"></script> |