function formCallback(result, form) { window.status = 'validation callback for form ' + form.id + ': result = ' + result; } var valid = new Validation('frm_validation', {immediate : true, onFormValidate : formCallback}); Validation.addAllThese([ ['required', 'Please fill in the above field.', function(v) { return !Validation.get('IsEmpty').test(v); }], ['validate-one-required', 'Please select a search option above.', function (v,elm) { var p = elm.parentNode; var options = p.getElementsByTagName('input'); return $A(options).any(function(elm) { return $F(elm); }); }], ['validate-selection', 'Please select.', function(v,elm){ return elm.options ? elm.selectedIndex > 0 : !Validation.get('IsEmpty').test(v); }], ['validate-digits', 'The field has to consist of numbers only.', function(v) { return Validation.get('IsEmpty').test(v) || !/[^\d]/.test(v); }], ['validate-alpha', 'The field has to consist of letters only.', function (v) { return Validation.get('IsEmpty').test(v) || /^[A-ZÀ-Ža-zà-ž\'-,\s]+$/.test(v) }], ['validate-email', 'An email address must looks like mail@domaine.com.', function (v) { return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v) }], ['validate-url', 'Please enter a valid URL.', function (v) { return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v) }], ['city', 'Please enter your city -and/or your post code.', { notOneOf: ['No city found'], minLength: 1 }], ['validate-password', 'Your password must be 6 to 10 characters long.', { minLength: 6, maxLength: 10 }], ['validate-password-confirm', 'Password and confirmed password do not match.', { equalToField: 'password' }] ]);