Form Validation clashes with Google Search
hi there
If I try and do a Client Validation on a page that has a Google Search form at the top, it just clashes and inserts loads of odd code and breaks the page:
function WAFV_GetValueFromInputType(formElement,inputType,trimWhite) {
var value="";
if (inputType == "select") {
if (formElement.selectedIndex != -1 && formElement.options[formElement.selectedIndex].value && formElement.options[formElement.selectedIndex].value != "") {
value = formElement.options[formElement.selectedIndex].value;
}
}
else if (inputType == "checkbox") {
if (formElement.length) {
for (var x=0; x<MM:BeginLock translatorClass="wagt_search" type="wagt_search" orig="%3CformElement.length%20;%20x++)%20%20{
%20%20%20%20%20%20%20%20if%20(formElement[x].checked%20&&%20formElement[x].value!=%22%22)%20%20{
%20%20%20%20%20%20%20%20%20%20value%20=%20formElement[x].value;
%20%20%20%20%20%20%20%20%20%20break;
%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20}
%20%20%20%20}
%20%20%20%20else%20if%20(formElement.checked)
%20%20%20%20%20%20value%20=%20formElement.value;
%20%20}
%20%20else%20if%20(inputType%20==%20%22radio%22)%20%20{
%20%20%20%20if%20(formElement.length)%20%20{
%20%20%20%20%20%20for%20(var%20x=0;%20x%3CformElement.length;%20x++)%20%20{
%20%20%20%20%20%20%20%20if%20(formElement[x].checked%20&&%20formElement[x].value!=%22%22)%20%20{
%20%20%20%20%20%20%20%20%20%20value%20=%20formElement[x].value;
%20%20%20%20%20%20%20%20%20%20break;
%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20}
%20%20%20%20}
%20%20%20%20else%20if%20(formElement.checked)
%20%20%20%20%20%20value%20=%20formElement.value;
%20%20}
%20%20else%20if%20(inputType%20==%20%22radiogroup%22)%20%20{
%20%20%20%20for%20(var%20x=0;%20x%3CformElement.length;%20x++)%20%20{
%20%20%20%20%20%20if%20(formElement[x].checked%20&&%20formElement[x].value!=%22%22)%20%20{
%20%20%20%20%20%20%20%20value%20=%20formElement[x].value;
%20%20%20%20%20%20%20%20break;
%20%20%20%20%20%20}
%20%20%20%20}
%20%20}
%20%20else%20if%20(inputType%20==%20%22iRite%22)%20%20{
%20%20%20%20%20var%20theEditor%20=%20FCKeditorAPI.GetInstance(formElement.name)%20;
%20%20%20%20%20value%20=%20theEditor.GetXHTML(true);
%20%20}
%20%20else%20%20{
%20%20%20%20var%20value%20=%20formElement.value;
value=value.replace(/%3Cp%3E(\&\#160\;)*%3C\/p%3E/,%22%22);
%20%20}
%20%20if%20(trimWhite)%20%20{
%20%20%20%20value%20=%20WAtrimIt(value);
%20%20}
%20%20return%20value;
}
function%20WAAddError(formElement,errorMsg,focusIt,stopIt)%20%20{
%20%20if%20(document.WAFV_Error)%20%20{
%20%20document.WAFV_Error%20+=%20%22\n%22%20+%20errorMsg;
%20%20}
%20%20else%20%20{
%20%20%20%20document.WAFV_Error%20=%20errorMsg;
%20%20}
%20%20if%20(!document.WAFV_InvalidArray)%20%20{
%20%20%20%20document.WAFV_InvalidArray%20=%20new%20Array();
%20%20}
%20%20document.WAFV_InvalidArray[document.WAFV_InvalidArray.length]%20=%20formElement;
%20%20if%20(focusIt%20&&%20!document.WAFV_Focus)%20%20{
document.WAFV_Focus%20=%20focusIt;
%20%20}
%20%20if%20(stopIt%20==%201)%20%20{
document.WAFV_Stop%20=%20true;
%20%20}
%20%20else%20if%20(stopIt%20==%202)%20%20{
formElement.WAFV_Continue%20=%20true;
%20%20}
%20%20else%20if%20(stopIt%20==%203)%20%20{
formElement.WAFV_Stop%20=%20true;
formElement.WAFV_Continue%20=%20false;
%20%20}
}
etc etc...