Board index Plugins Contact Form Plugin

Creating and modifying plugins.
Imajica
Regular
 
Posts: 54
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine

Postby Imajica » Sat Feb 25, 2017 1:55 am

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 9:14 pm, edited 1 time in total.

User avatar
yellowled
Regular
 
Posts: 6819
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Sat Feb 25, 2017 8:22 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
 
Posts: 6819
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Sat Feb 25, 2017 8:31 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Imajica
Regular
 
Posts: 54
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine

Postby Imajica » Sat Feb 25, 2017 9:08 pm

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

User avatar
yellowled
Regular
 
Posts: 6819
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Sat Feb 25, 2017 10:54 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
 
Posts: 3576
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Tue Feb 28, 2017 7:24 am

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.

Imajica
Regular
 
Posts: 54
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine

Postby Imajica » Thu Mar 02, 2017 3:34 am

I'll give it a go and see what I can break :)

User avatar
Don Chambers
Regular
 
Posts: 3576
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Thu Mar 02, 2017 4:21 am

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.

Imajica
Regular
 
Posts: 54
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine

Postby Imajica » Fri Mar 03, 2017 1:38 am

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

User avatar
Don Chambers
Regular
 
Posts: 3576
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Sun Mar 05, 2017 4:26 am

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.

Imajica
Regular
 
Posts: 54
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine

Postby Imajica » Tue Mar 07, 2017 4:32 am

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

User avatar
Don Chambers
Regular
 
Posts: 3576
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Tue Mar 07, 2017 4:34 am

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.

Imajica
Regular
 
Posts: 54
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine

Postby Imajica » Fri Mar 17, 2017 5:07 am

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

John

User avatar
Don Chambers
Regular
 
Posts: 3576
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Sat Mar 18, 2017 1:50 am

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.

User avatar
Don Chambers
Regular
 
Posts: 3576
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Sat Mar 18, 2017 4:55 pm

I updated the Timeline theme on github. It now includes plugin_dynamicform.tpl.



Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest