Contact Form Plugin

Creating and modifying plugins.
Post Reply
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Contact Form Plugin

Post by Imajica »

Evening Folks,

I'm working on a site where I am using several instances of the Contact Form Plugin version: 1.19
If I use "Use the dynamic tpl? Standard" is sizes to mobile just fine but if I choose custom it doesn't scale properly

Any ideas where I can set the width properly?

Thank you
John
Last edited by Imajica on Sat Feb 25, 2017 8:14 pm, edited 1 time in total.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: COntact Form Plugin

Post by yellowled »

Imajica wrote:If I use "Use the dynamic tpl? Standard" is sizes to mobile just fine but if I choose custom it doesn't scale properly
Do you have an URL to a live site so we can check this out? If so, please mention which one you have it currently set to. If not, please state which theme you're using. (Hint: If it's a non-public blog with a custom theme, this will be difficult to resolve.)

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: COntact Form Plugin

Post by yellowled »

yellowled wrote:If not, please state which theme you're using. (Hint: If it's a non-public blog with a custom theme, this will be difficult to resolve.)
It might not have much to do with the theme you're using.

As an explanation, Standard and Custom use different templates files to display the contact form. Most themes do not provide a plugin_dynamicform.tpl (which would be used for Custom) since it's rarely used and often needs to be adapted to the specific needs of the user anyway (read: theme authors are lazy :mrgreen:). So if your theme does not have a plugin_dynamicform.tpl, the plugin's default tpl will be used and most likely not match the CSS of your theme.

Do you need a customized contact form? If so, you'd need to adapt the plugin_dynamicform.tpl for your theme (we can help you with that). If you just wanted to test it and mention that it doesn't work, it's probably not worth the effort (few people ever need the dynamic form, which is why … see above). :wink:

YL
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Re: COntact Form Plugin

Post by Imajica »

yellowled wrote:Do you have an URL to a live site so we can check this out? If so, please mention which one you have it currently set to. If not, please state which theme you're using. (Hint: If it's a non-public blog with a custom theme, this will be difficult to resolve.)

YL
http://www.stormscellar.com/s-mtranspor ... reers.html

the base theme is Timeline by the way

it's not live yet but this is a temp url

In this case I do need to create 2 custom forms for requesting quotes and more information
I often use custom forms for specific clients, for example the next site I am converting over is for a special olympics swim team and they use a custom form for athletes to request information and to join the team so I will need to add fields with dropdowns and checkboxes

so I may as well learn how to do it the right way

Thanks YL

John
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: COntact Form Plugin

Post by yellowled »

Imajica wrote:In this case I do need to create 2 custom forms for requesting quotes and more information
I often use custom forms for specific clients, for example the next site I am converting over is for a special olympics swim team and they use a custom form for athletes to request information and to join the team so I will need to add fields with dropdowns and checkboxes
I must admit I'm not too familiar with the markup for Timeline, but maybe Don will chime in on this.

Timeline does provide a template for the standard contact form, which you find in /templates/timeline/plugin_contactform.tpl. As all Serendipity template files, this uses Smarty.

However, Timeline does not provide a plugin_dynamicform.tpl (and you may very well need multiple versions of this, I'm not sure; I usually don't need custom contact forms, so I'm not too familiar with the process), so you can copy the original from /plugins/serendipity_event_contactform/plugin_dynamicform.tpl to /templates/timeline/. Since this is not part of Timeline or the Serendipity core, it will be update-safe, i.e. not overwritten in case of an update to Serendipity.

Basically, you would need to “transport” the markup used in Timeline's plugin_contactform.tpl to the new plugin_dynamicform.tpl, using the same markup, classes etc. that Timeline uses. For example, Timeline wraps the whole contact form in

Code: Select all

<article{if $plugin_contactform_articleformat} class="post serendipity_staticpage serendipity_entry{/if}">
<!-- contact form here -->
</article>
but plugin_dynamicform.tpl does not do that, so you'd need to add that. Here's the catch, though: plugin_dynamicform.tpl uses some code that plugin_contactform.tpl does not (need). For example, it has code to include radio buttons

Code: Select all

{elseif $field.type == "radio"}
     {foreach name="radio_option" from=$field.options item="option"}
        <input type="radio" name="{$field.id}" id="{$field.id}.{$option.id}" value="{$option.value}" {$option.default} /><label for="{$field.id}.{$option.id}">{$option.name}</label>
    {/foreach}
You would need to adapt that according to the Bootstrap CSS framework that Timeline is built upon – I assume that the required CSS is already there, but it might require a wrapper <div> (or not) and/or some classes added to the <input> element. Also, the original plugin_dynamicform.tpl still uses a <table> layout, which should definitely be changed to make it responsive (work on mobile etc.)

It might be worthwhile to contact Don Chambers about this, this definitely is a task for someone who's skilled with Smarty and knows the CSS framework …

YL
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Contact Form Plugin

Post by Don Chambers »

Hey John. YL is correct in everything he mentions. Very easy to code a custom contact form, and I can try to walk you through it.
=Don=
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Re: Contact Form Plugin

Post by Imajica »

I'll give it a go and see what I can break :)
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Contact Form Plugin

Post by Don Chambers »

Its a little more involved than I thought it would be. I started working on a plugin_dynamicform.tpl for timeline earlier today thinking it was10 minutes of effort.... it is not 10 minutes of effort! :evil: I will try to finish it tonight or tomorrow then update the timeline theme.
=Don=
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Re: Contact Form Plugin

Post by Imajica »

Don Chambers wrote:Its a little more involved than I thought it would be. I started working on a plugin_dynamicform.tpl for timeline earlier today thinking it was10 minutes of effort.... it is not 10 minutes of effort! :evil: I will try to finish it tonight or tomorrow then update the timeline theme.
ok good... because I tried and yup I broke it

luckily ctrl Z is my friend
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Contact Form Plugin

Post by Don Chambers »

I committed a change to the contactform plugin... using timeline, this is my latest idea for using the dynamic form: http://www.optional-necessity.com/demo/ ... -form.html

Submit the form as much as you want - it is assigned to a fake email address.

If all looks good, I will commit modifications to the Timeline theme, and possibly the contactform tpls.
=Don=
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Re: Contact Form Plugin

Post by Imajica »

Don
This looks go to me so far
I'll test it on my site as soon as it's uploaded

I'll assume it will pick up the recaptcha, if enabled?

John
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Contact Form Plugin

Post by Don Chambers »

Imajica wrote:Don
This looks go to me so far
I'll test it on my site as soon as it's uploaded

I'll assume it will pick up the recaptcha, if enabled?

John
Recaptcha is introduced via a "hook"... should work just fine. I will try to update github tonight or tomorrow. Make sure you also update your contactform plugin..... I updated that a day or two ago.
=Don=
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Re: Contact Form Plugin

Post by Imajica »

Hey Don.. did the updated form get uploaded to git?
I can't seem to find it

John
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Contact Form Plugin

Post by Don Chambers »

I was trying to squeeze a few other updates into the theme files... but I will try to upload the THEME files for the contact form plugin modifications.
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Contact Form Plugin

Post by Don Chambers »

I updated the Timeline theme on github. It now includes plugin_dynamicform.tpl.
=Don=
Post Reply