Contact Form - add plain text to custom field list?

Creating and modifying plugins.
Post Reply
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Contact Form - add plain text to custom field list?

Post by Don Chambers »

Wondering if this is a PITA, or easy to implement....

I'd like to create a custom contact form that includes plain text between some of the fields, perhaps something like:

Heading 1
Description blah blah blah
Field 1:
Field 2:
Etc...


Heading 2
A different description blah blah
Field 3
Field 4
Etc...


Would that be possible within the current method of supplying a huge form field string: require;Name;text:require;Email;text:require;Homepage;text:require;Message;textarea;

And as long as I am making suggestions, perhaps a field that describes the contact form as is provided by the html nugget with "Additional information in Plugin Configuration screen" - which comes in real handy when the contact form plugin is installed more than once.

Oh yeah - didn't this plugin used to have the ability to identify a tpl to use by name? That might come in handy as well - the ability to design a different looking form for each instance the plugin is used.
=Don=
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Garvin? Judebert? Anyone?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Would mean a quite complex rewrite, can't offer to do that :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I figured it would be a PITA. How about the "Additional information in Plugin Configuration screen" field and the ability to have a unique tpl so that multiple instances of the plugin can uses different tpl's?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

That's a good idea, I just committed an update where you should be able to specify your own template, and then you can check for your own custom field types, so that you can specify things like:

Code: Select all

info1;infobubble;info2;infobubble;field1;text;field2;textarea
and then you use your own custom template file and have somethinglike:

Code: Select all

{foreach name="field" from=$commentform_dynamicfields item="field"}
   {if $field.type != "hidden"}
    <tr>
       <td class="serendipity_commentsLabel">{if $field.required}<sup>*</sup>{/if}<label for="serendipity_commentform_{$field.id}">{$field.name}</label></td>
       <td class="serendipity_commentsValue">
          {if $field.type == "checkbox"}
                <input type="checkbox" name="{$field.id}" id="{$field.id}" {$field.default} /><label for="{$field.id}">{$field.message}</label>
          {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}
          {elseif $field.type == "select"}<select name="{$field.id}">
             {foreach name="radio_option" from=$field.options item="option"}
                <option name="{$field.id}" id="{$field.id}.{$option.id}" value="{$option.value}" {$option.default} >{$option.name}</option>
             {/foreach}</select>
          {elseif $field.type == "password"}
              <input type="password" id="serendipity_commentform_{$field.id}" name="serendipity[{$field.id}]" value="{$field.default}" size="30" />
          {elseif $field.type == "textarea"}
              <textarea rows="10" cols="40" id="serendipity_commentform_{$field.id}" name="serendipity[{$field.id}]">{$field.default}</textarea><br />
          {elseif $field.type == 'infobubble'}
               {if $field.id == 'info1'}
               This is an important information and contains your custom text because it won't fit into the small input area of the plugin config and is thus hardcoded here in this template file.
               {elseif $field.id == 'info2'}
               This is not important.
               {/if}
          {else}
              <input type="text" id="serendipity_commentform_{$field.id}" name="serendipity[{$field.id}]" value="{$field.default}" size="30" />
          {/if}
       </td>
    </tr>
   {/if}
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Awesome Garvin - I'll check it out a bit later this afternoon when I have more time.

So, field types like "info1, info2" are not understood by any of the existing tpl's, only by a custom one, is that correct?

Also, while we're on it - what exactly is the implication of a field type "password"?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, that's true. You need to build your own "type" and put it into your custom template.
Also, while we're on it - what exactly is the implication of a field type "password"?
Simply an input type filed for password. The input of the user is hidden, that's all. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Something is not correct Garvin - when I select "custom" for the type, I get

Template file name
Only enter the filename of a custom template file that will be used to render this contact form. You can upload custom files to either the directory of this plugin, or your current template directory.

Template file name
Only enter the filename of a custom template file that will be used to render this contact form. You can upload custom files to either the directory of this plugin, or your current template directory.

... in other words, I get PLUGIN_CONTACTFORM_DYNAMICFIELDS_DESC twice, not once followed by PLUGIN_CONTACTFORM_DYNAMICFIELDS_DESC_NOTE
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Thanks, there was a "break;" missing!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Much better! 8) I'll take it for a test drive and let you know how it works out.
=Don=
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Garvin - can you add a field for "Additional information in Plugin Configuration screen" so that multiple instances of the plugin can be easily recognized in teh backend (like the html nugget)? By the time I am done with this, I could have a half dozen or more contact forms, and I cannot tell the difference between them right now in the backend.

Another suggestion - I know the plugin will email to multiple addresses if they are separated by commas (or is it semi-colons?!), but how about some other separator that, if provided, can be used in conjunction with a new field type that creates a dropdown of possible email destinations, but does not reveal that email address....

ie, something like:

Target E-Mail address: Webmaster|webmaster@example.com;selected,Advertising|advertising@example.com,Sales|johndoe@example.com

Then for positioning, there is a field type "emailselect":

Code: Select all

require;Name;text:require;Email;text:require;Mail to;emailselect:require;Message;textarea;
So I see a dropdown list of Webmaster, Advertising and Sales, with webmaster selected by default.

Whatcha think?
=Don=
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

EDIT: emails may be a server issue, so diregard that until I can verify.

Hmmm.. emails were going out in my tests just before upgrading to the latest - now I am not receiving the contact form email. Also - I get a blank page if choose "small business" or "detailed" form types.

Also - can you provide a field that will override the subject line of the email? "[BlogName] New comment posted to Contact Form" just does not make sense for what I want to use this for... also, if this field existed for each instance of the plugin, each could use a unique subject line. If blank, it could default to the current language-specific default.

If it cannot be a full override, then [BlogName]$plugin_contactform_pagetitle would be preferrable IMHO.

And one final suggestion - how about a language constant for just "submit" - ie, @define('SUBMIT', 'Submit'); - which a tpl could use instead of $CONST.SUBMIT_COMMENT"
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I added the backend subtitle, fixed the blank page problem. Emails should be unrelated to my update, I'll wait for your server check.
Also - can you provide a field that will override the subject line of the email? "[BlogName] New comment posted to Contact Form" just does not make sense for what I want to use this for... also, if this field existed for each instance of the plugin, each could use a unique subject line. If blank, it could default to the current language-specific default.
This is a internal s9y routine, it cannot be easily overriden by plugins. They would then do their own emailing completely, creating a lot of redundancy.

As for your dropdown of mail choices: I like the idea, maybe someone can implement it!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Thanks for the upgrades and fixes Garvin - before we get into any other features I have requested (or maybe some I have not yet) - the email issue seems to be this: I have 2 instances of the contact form plugin installed. One is a simple contact form using the "standard" form. The second is a a custom form using a custom tpl, which is just a slightly modified dynamic form.

Whichever of these plugins is listed first in "configure plugins" will send its email. The second will not. Any idea why or what action to take to troubleshoot?
=Don=
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Still having server issues I think - so continue to disregard that for now. It's stuff like this that leads me to drink!!! LOL!!! :lol:
=Don=
Post Reply