close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form Validation clashes with Google Search

Thread began 10/08/2009 10:20 am by rob75685 | Last modified 10/19/2009 4:55 pm by rob75685 | 1532 views | 9 replies |

rob75685

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...

Sign in to reply to this post

Jason ByrnesWebAssist

The code you have pasted her is code needed for the client side validation to function, not "random" code. can you provide a link to the page that is not working so I can take a look at the problem.

Sign in to reply to this post

rob75685

Pages showing error

hi Jason

Here's the page with the form validation, but no Google Search:

contact.php

When I add the Google Search it ends up like this:

test.php

If you look at the source you'll see that the validation script has broken

thanks

Sign in to reply to this post

Jason ByrnesWebAssist

I am not able to reproduce the problem using the latest version of Dreamweaver Tools for Google.

Looking at the broken code, could it be possible that you cursor was inside of the javascript code when you added the Google Search?


What version of Dreamweaver tools for Google do you have installed?

What version of Dreamweaver?

What is you OS?

Sign in to reply to this post

rob75685

Specs

hi Jason

I'm using OSX 10.6.1

DW 9 (CS3)

GoogleToolkit203

Sign in to reply to this post

anonymous

Rob,

I had a similar issue a couple of week's back and found that (in my issue) it was just related to having an additional form on the page that preceded by second form so when adding client validation, it actually didn't set the form id correctly. One thing you may want to check is in your Behaviors Panel (Not Server Behaviors) and look at the Client Validations... first make sure they are all there and then inspect them... I had to manually change the form to reflect the correct form id to fix the issue. I think Ray said in future versions, this would get fixed as the Client Validation would then assign form ID names if one did not exist as the problem I had seemed to be related to the fact that validation currently assigns an array such as form(0), form(1), etc.

Best regards,

Brian

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into the cause of this issue.

To view and edit your support ticket, please log into your support history.

Sign in to reply to this post

rob75685

No support ticket

hi Jason

Thanks for your reply - I can't see a new support ticket though.... ?

Sign in to reply to this post

Jason ByrnesWebAssist

I just recreated it, can you see it now?

Sign in to reply to this post

rob75685

Yes

Yes thanks Jason - will post a reply on there

cheers

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...