/    Sign up×
Community /Pin to ProfileBookmark

<form>, <iframe>, <object>–AND–XHTML !

[B]Background[/B]

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!

[B]Problem[/B]

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!” 😮 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.

[B]Current Non-XHTML Code[/B]

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

[CODE]
<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 “/>
[/CODE]

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

[B]My Attempts to Fix[/B]

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

[CODE]
if(submitted){window.location=’ThankYouNew.html’;}
[/CODE]

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

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 04.2016 — I *think* what you are after is what is typically implemented now as a "modal window" (not really a "window", but an HTML block element that behaves like a pop-up window of sorts). You might want to try some googling of that to see if that might provide a better solution for you.
Copy linkTweet thisAlerts:
@kenmorganauthorMar 04.2016 — Thanks so much, NogDog, for getting back to me. I really appreciate it.

The "modal window" might very well accomplish the same purpose. But I already have my own thank-you" page that I'd like to use. The goal is to make the contact form code load MY "thank you" page (replacing the contact form page in the same tab), instead of the standard Google form "thank you" page. The non-xhtml code in my first post does this perfectly. So...the question is: how can I modify that code to make it xhtml strict?

One thing I failed to mention in my first post: after two days of fiddling with the code myself, I believe it is the "target" attribute that somehow suppresses the Google form "thank you" page.

Thanks again. I look forward to your suggestions.

Ken
×

Success!

Help @kenmorgan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...