How to handle form submissions?

General questions about CMSimple
Catfish
Posts: 14
Joined: Mon Mar 09, 2009 6:55 am

How to handle form submissions?

Post by Catfish » Sun Sep 20, 2015 12:00 pm

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!

Tata
Posts: 3601
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: How to handle form submissions?

Post by Tata » Sun Sep 20, 2015 3:04 pm

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.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Catfish
Posts: 14
Joined: Mon Mar 09, 2009 6:55 am

Re: How to handle form submissions?

Post by Catfish » Mon Sep 21, 2015 6:30 pm

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.

Tata
Posts: 3601
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: How to handle form submissions?

Post by Tata » Mon Sep 21, 2015 7:31 pm

how about to usse iframe dimension expressed in %? And use inline style for iframe?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

Catfish
Posts: 14
Joined: Mon Mar 09, 2009 6:55 am

Re: How to handle form submissions?

Post by Catfish » Tue Sep 22, 2015 4:57 am

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.

lck
Posts: 3211
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: How to handle form submissions?

Post by lck » Tue Sep 22, 2015 8:28 am

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.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

ahref
Posts: 8
Joined: Mon Oct 26, 2015 8:33 am

Re: How to handle form submissions?

Post by ahref » Tue Oct 27, 2015 4:54 pm

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?

Tata
Posts: 3601
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: How to handle form submissions?

Post by Tata » Fri Apr 01, 2016 10:23 am

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>
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

bastingse
Posts: 308
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: How to handle form submissions?

Post by bastingse » Sat May 14, 2016 7:40 am

Tata, find a solution already for the fluidmedia coding??

lck
Posts: 3211
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: How to handle form submissions?

Post by lck » Mon May 16, 2016 12:05 pm

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?
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

Post Reply