<form>, <iframe>, <object>--AND--XHTML

Background

On my “Google drive” I set up a contact form to use on my Web sites. However, in order to customize it, I did not use the embedding code on a Web site page, but copied and pasted the entire <form>...</form> section of the code into my page in order to create a contact form. This eliminated unnecessary links in Google’s code, and also allowed me to customize the form with my own CSS.

Then I found some Javascript code online to validate the email address input and also some Javascript code (not php code!) for a captcha. I also installed code that brings up my own “thank you” page (not the standard Google thank-you page) once the form is successfully submitted.

Everything works perfectly!

Problem

BUT, I always put all my pages through the W3C validator for XHTML 1.0 Strict. I even have their little success logo at the bottom of every page on all my Web sites. When I proudly put my new contact form page through the validator, to quote Capt. Renault, I was “Shocked! Shocked!” :o Quite few Items in the code are not supported in XHTML Strict. I did some Goggling and went to many Web sites to find ways to bring the code I had in this contact form up to XHTML Strict standards. After a whole day of fiddling, I have not succeeded. So here’s a call for help. I would certainly appreciate any suggestions any of you might have.

Current Non-XHTML Code

The following code is just before the tag; the tag itself is also displayed here, and the submit tag later in the code is shown as well–

<script type="text/javascript">
//<![CDATA[
<script type="text/javascript">
   var submitted=false;
//]]>
</script>

<iframe name="hidden_iframe"
        id="hidden_iframe"
        style="display:none;"
        onload="if(submitted){window.location='ThankYouNew.html';}">
</iframe>

<form action="https://docs.google.com/forms/d/1omcsxmunEkwUscUHp2i2CM3eQlX4PsMXAHcC9fh_J-o/formResponse" method="post" id="ss-form" target="hidden_iframe" onsubmit="return checkform(this)">
.
.
.
<input type="submit" name="submit" value="Submit" id="ss-submit" class="jfk-button jfk-button-action "/>

The function checkform(this) contains all the Javascript code to check the entered email address and for the captcha.

As you probably know, and as I just found out, XHTML Strict does not support iframe. It also doesn’t support the “target” attribute in the tag.

My Attempts to Fix

I tried using <object> instead of <iframe>. Couldn’t get it to work.

I tried writing a Javascript function that would execute the Javascript code currently in the <iframe>

if(submitted){window.location='ThankYouNew.html';}

Nothing I tried either in the <form> tag or the <input> submit tag would execute the function.

So…any ideas on how I can bring this code up to XHTML Strict standards???

Thanks so much.

Ken

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.