Revision 4752
Added by daigle almost 16 years ago
lib/admin/admin.js | ||
---|---|---|
24 | 24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 | 25 |
*/ |
26 | 26 |
|
27 |
function validateForm(form_ref) { |
|
28 |
j = form_ref.length |
|
29 |
for (i = 0; i < j; i++) { |
|
27 |
function createExclusionList() { |
|
28 |
exclusionList = new Array(); |
|
29 |
} |
|
30 |
|
|
31 |
function addExclusion(exclusionName) { |
|
32 |
exclusionList.push(exclusionName); |
|
33 |
} |
|
34 |
|
|
35 |
function validateForm(form_ref) { |
|
36 |
for (i = 0; i < form_ref.length; i++) { |
|
30 | 37 |
if (form_ref.elements[i].value == "") { |
31 |
alert("All form fields must be populated"); |
|
32 |
return false; |
|
38 |
excludeThisField="false"; |
|
39 |
for (j = 0; j < exclusionList.length; j++) { |
|
40 |
if (exclusionList[j] == form_ref.elements[i].id) { |
|
41 |
excludeThisField="true"; |
|
42 |
} |
|
43 |
} |
|
44 |
if (excludeThisField == "true") { |
|
45 |
alert("All form fields must be populated"); |
|
46 |
return false; |
|
47 |
} |
|
33 | 48 |
} |
34 | 49 |
} |
35 | 50 |
return true; |
36 | 51 |
} |
37 | 52 |
|
38 | 53 |
function submitForm(form_ref) { |
39 |
// form_ref.action.value=action; |
|
40 |
// form_ref.sessionId.value=<xsl:value-of select="$sessid" />; |
|
41 | 54 |
form_ref.submit(); |
42 | 55 |
} |
43 | 56 |
|
44 | 57 |
function validateAndSubmitForm(form_ref) { |
45 |
// form_ref.action.value=action; |
|
46 |
// form_ref.sessionId.value=<xsl:value-of select="$sessid" />; |
|
47 | 58 |
if (!validateForm(form_ref)) { |
48 | 59 |
return false; |
49 | 60 |
} |
Also available in: Unified diff
add the ability to validate that only required fields are populated.