Help in passing HTML code through the...

User 2062767 Photo


Registered User
166 posts

Please can you help - this has got to be something really simple but I don't know what. :/

I am trying to send some html content from an HTML page to my form confirm.php page.

I am using this script - which works fine in getting the content to the form.
<script>
<!--
function myInput()
{
myheader = document.getElementById("mainHeader").innerHTML;
document.myForm.myheader.value = myheader;
}
//-->
</script>

But I can't seem to configure my "Confirm options" to get it to display correctly.
If I just use [myHeader] it displays as HTML script (on the page not the source)
If I use this:
<!DOCTYPE html>
<html lang="en">
<header id="mainHeader"></header>
<script>
x="[myheader]";
document.getElementById("mainHeader").innerHTML=x;
</script>
</html>
It does not display at all. :/
I have also tried this:
<script>
document.getElementById("mainHeader").innerHTML=[myheader];</script>
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431
User 187934 Photo


Senior Advisor
20,271 posts

The form builder only knows which variables are being used if you add them to your form by using the built in elements. What you'll need to do is keep the element holding the html hidden with some css.
#myhtml{
display:none;
}
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2062767 Photo


Registered User
166 posts

The big problem with that is the "document.getElementById" has to go after the element to work. I am passing the element to the form on the confirm page. :/
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431
User 187934 Photo


Senior Advisor
20,271 posts

So your using $_SESSSION's?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2062767 Photo


Registered User
166 posts

Don't think so, I am not sure what $_SESSSION's are. :/

This is an example of the full code I am using:

<!DOCTYPE html>
<html lang="en">
<head>
<title>My Form</title>
</head>
<body>
<header id="mainHeader"> <div>
Some more HTML content here</div>
</header>
<script>
<!--
function myInput()
{
myheader = document.getElementById("mainHeader").innerHTML;
document.myForm.myheader.value = myheader;
}
//-->
</script>
Form to send data to my form.
<form name="myForm" action="http://www.mydomain.co.uk/forms/my_form/" method="POST">

<input type="hidden" name="myheader" id="myheader" />
<input onClick="myInput()" type="submit" value="Submit" />

</form>
</body>
</html>

Configured "Confirm options" in Form Builder
Method 1. [myHeader] - displays as HTML script (on the page not the source)
Method 2. <script>
document.getElementById("mainHeader").innerHTML=[myheader];</script> - does not display anything at all.
Method 3. <script>
document.getElementById("mainHeader").innerHTML=\[myheader\];</script> - does not work either.
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431
User 2062767 Photo


Registered User
166 posts

I have found the problem but don't know how to solve it. :/

Looking at the source the code of the confirm page, the code is written like this, whether it is in [ ]'s or in the script.

<!DOCTYPE html>
<html dir="ltr" lang="en">
<body>
&lt;h1&gt;
&lt;a href=&quot;index.html&quot;&gt;
&lt;div id=&quot;local&quot;&gt;&lt;b&gt;Address&lt;/b&gt;&lt;/div&gt;
&lt;/a&gt;&lt;/h1&gt;
<header id="mainHeader"></header>
<script>
document.getElementById("mainHeader").innerHTML=&lt;h1&gt;
&lt;a href=&quot;index.html&quot;&gt;
&lt;div id=&quot;local&quot;&gt;&lt;b&gt;Address&lt;/b&gt;&lt;/div&gt;
&lt;/a&gt;&lt;/h1&gt;;
</script>
</body>
</html>

As you can see there are &lt;'s where there should be <'s etc. Which explains why it is not displaying correctly.

The strange thing is when I get the email, everything is displayed as it should be. :rolleyes:

Is there something I can add to the script so it reads correctly?
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431
User 187934 Photo


Senior Advisor
20,271 posts

If your altering the way the form builder submits data then your best bet is to write your own custom confirmation page.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2062767 Photo


Registered User
166 posts

I am using the "Redirect to custom HTML page" field within Form Builder. Strange the emails work but not the custom page!
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431
User 187934 Photo


Senior Advisor
20,271 posts

You'll need to set your own $_SESSION's to carry variables to the redirect page.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2062767 Photo


Registered User
166 posts

No offence Eric but that doesn't really help. Isn't $_SESSION something to do with php? Apart from the fact I no nothing about php coding, I am using S-Drive so that would not work.

Not sure if I am explaining myself & you understand what I am trying to get at.

To make it clearer - I have no trouble getting the HTML data to the form using myInput() function (see earlier ticket) it is the way the form handles the HTML code that is the problem. I need to do this because the HTML will be dynamic.

For example if I was to put this HTML code <div><b>Some text</b></div> into SCC without using triple [ ]'s ie. [[[<div><b>Some text</b></div>]]] it would display as <div><b>Some text</b></div>. Otherwise is would display as Some text. This is what I want to happen in my form.

BTW I have tried using [[[ ]]] & that didn't work.
I have also tried unescape(str), encodeURIComponent( ) & decodeURIComponent( ).

The form must be reading the HTML somewhere along the line because it displays correctly in the email!

Anyone's suggestions gratefully welcome :)
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.