Page 1 of 2
How to handle form submissions?
Posted: Sun Sep 20, 2015 12:00 pm
by Catfish
Hi there,
I would like to handle a form submission so that tthe handling code is displayed inside my cmsimple template. I am using hd_pd_scripting plugin to let me exdcute my own php code in my pages. The first page has the form HTML in it, but I don't kmow what to set the <form action> to? If I action it to a file.php the loaded page won't be inside the nice cmsimple page template.
I have tried no action value, and also tried the URL of the cmsimple page that I want to handle the form but none of it works.
Please help! I'm stuck!
Re: How to handle form submissions?
Posted: Sun Sep 20, 2015 3:04 pm
by Tata
I tested it once on a tespage:
1. having external file calling it into an iframe on a regular internal page, then the action is not necessary or may be directed on the file self.
- here I had the myfile.php file with form in the root.
- the code on the page was
Code: Select all
<p><iframe style="margin: 0; padding: 0; border: none; width: 520px; height: 310px;" src="http://myURL/myfile.php" width="320" height="240"></iframe></p>
- the myfile.php had this code
Code: Select all
<form id="myform" name="myform" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>">
Code: Select all
<style>
@media all and(max-width:420px){
table.box_left, table.box_right{width: 100px;} /*make sure, that the form will fit to narow devices. there is no need wor very width forms. */
}
</style>
-DONT FORGET that any styling shall be dropped in the file or properly linked.
2. the other way is placing the form into a newsbox (again, the relevant page is content.htm, so IMHO any redirection is redundant).
3. third way now is using Holger's fancybox plugin.
Re: How to handle form submissions?
Posted: Mon Sep 21, 2015 6:30 pm
by Catfish
Thank you for your advice. I used an iframe and it seems to work well enough.
Just for future reference I will document what I did here:
Create a normal php file that handles the form data (and/or lack thereof)
Use the iframe tag as shown above to load the php code into the cmsimple page
The iframe basically operates like a seperate page to that generated by cmsimple, so as said above, the styling cmsimple has will not exist in what the iframe does.
Pros: easy if you are used to using individual html/php files to handle forms
Cons: styling doesnt get used, iframe exists in a fixed size element on the page unless you use ssome javascript to automatically resize it (I couldn't get it to work)
I will probably do a more detailed breakdown of what I did and put it on my website. If I do I will edit and link here.
Re: How to handle form submissions?
Posted: Mon Sep 21, 2015 7:31 pm
by Tata
how about to usse iframe dimension expressed in %? And use inline style for iframe?
Re: How to handle form submissions?
Posted: Tue Sep 22, 2015 4:57 am
by Catfish
I used % for the iframe width, but couldn't get the height to auto adjust. I don't know much about styling webpages. Mainly just php.
Re: How to handle form submissions?
Posted: Tue Sep 22, 2015 8:28 am
by lck
Catfish wrote:I used % for the iframe width, but couldn't get the height to auto adjust.
Perhaps this will help:
Fluid iframe Responsive iFrames
As an alternative to the iframe, could be the plugin
GXGetUrl, see also
Thread.
Re: How to handle form submissions?
Posted: Tue Oct 27, 2015 4:54 pm
by ahref
Ludwig wrote:Catfish wrote:I used % for the iframe width, but couldn't get the height to auto adjust.
Perhaps this will help:
Fluid iframe Responsive iFrames
As an alternative to the iframe, could be the plugin
GXGetUrl, see also
Thread.
I agree with Ludwig on these options. You want to make sure the forms are responsive. Keep them minimal, and whenever you can, incorporate auto-fill. Otherwise you are looking at people abandoning the form if it's long and complex. What kind of site is this form for?
Re: How to handle form submissions?
Posted: Fri Apr 01, 2016 10:23 am
by Tata
I have found these hints on internet. But they don't work on my webpage. Using codes:
Code: Select all
/* IFRAME */
.fluidMedia {
position: relative;
padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
padding-top: 30px;
height: 0;
overflow: auto;
}
.fluidMedia iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Code: Select all
<div class="fluidMedia"><iframe src="./gallery" frameborder="0"></iframe></div>
results after saving in
Code: Select all
<div class="fluidMedia"><iframe src="./gallery" frameborder="0" width="320" height="240"></iframe></div>
Re: How to handle form submissions?
Posted: Sat May 14, 2016 7:40 am
by bastingse
Tata, find a solution already for the fluidmedia coding??
Re: How to handle form submissions?
Posted: Mon May 16, 2016 12:05 pm
by lck
width = "320" height = "240" that are the default values of TinyMCE, automatically entered when no information was given to width and height.
Not interfere with these values, they are overwritten by the responsive iFrame.
Also helpfull, richu's Tutorial
"Anleitung ein YouTube Video responsive in Ihre eigene Webseite einzubinden."
An alternative would be the
CKEditor.
BTW @Holger: Is this maintained even further?