| 1 |
// $Id: customization.js,v 1.1 2006/06/02 15:34:18 nedjo Exp $
|
| 2 |
|
| 3 |
// wForms - a javascript extension to web forms.
|
| 4 |
// Customization Example (wForms v0.94 - April 26 2005)
|
| 5 |
// Copyright (c) 2005 Cédric Savarese <pro@4213miles.com>
|
| 6 |
// This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
|
| 7 |
|
| 8 |
//The Repeat behavior preserves the name attribute of radio inputs
|
| 9 |
// accross repeated elements, effectively expanding the radio group.
|
| 10 |
// Set to false to make repeated radio inputs independant.
|
| 11 |
wFORMS.preserveRadioName = true; // default: true.
|
| 12 |
|
| 13 |
// The validation routine will display an alert box if theres an error, with the message in wf.arrErrorMsg[8]
|
| 14 |
wFORMS.showAlertOnError = true; // default: true.
|
| 15 |
|
| 16 |
// Error message displayed in the alert box.
|
| 17 |
wFORMS.arrErrorMsg[8] = "%% error(s) detected. Your form has not been submitted yet.\nPlease check the information you provided."; // %% will be replaced by the actual number of errors.
|
| 18 |
|
| 19 |
// overwrite the default form submission handler with a custom one.
|
| 20 |
wFORMS.functionName_formValidation = "customValidation";
|
| 21 |
|
| 22 |
//e : onSubmit event
|
| 23 |
function customValidation(e) {
|
| 24 |
// Kill if we're in the midst of a file upload.
|
| 25 |
// We test for a given line in the iframehandler function
|
| 26 |
// set by function redirectFormButton() in drupal.js.
|
| 27 |
if (window.iframeHandler) {
|
| 28 |
var func = window.iframeHandler.toString();
|
| 29 |
if(func.indexOf('button.form.action = action') > 0) {
|
| 30 |
return;
|
| 31 |
}
|
| 32 |
}
|
| 33 |
/**
|
| 34 |
* This is an alternate approach, but hard-coded to the
|
| 35 |
* 'fileop' id, so dropped in favour of the above.
|
| 36 |
*/
|
| 37 |
if (document.getElementById('fileop') && (document.getElementById('fileop').onclick != null)) {
|
| 38 |
return;
|
| 39 |
}
|
| 40 |
|
| 41 |
if(wf.formValidation(e)) { // call the default error management.
|
| 42 |
// basic wForms Validation Ok... can do other stuff here
|
| 43 |
// if validation not ok, use return wf.utilities.XBrowserPreventEventDefault(e);
|
| 44 |
return true;
|
| 45 |
} else {
|
| 46 |
return wf.utilities.XBrowserPreventEventDefault(e); // will prevent the form from being submitted.
|
| 47 |
}
|
| 48 |
}
|