Questions about contactform plugin

Creating and modifying plugins.
User avatar
kybernator
Regular
Posts: 126
Joined: Sat Sep 22, 2012 10:15 pm

Questions about contactform plugin

Post by kybernator » Sat May 09, 2015 11:50 pm

Many questions about plugins from me these days, I do hope I don't get on your nerves.

Also, I tend to look closely and see things like double exclamation marks and so on, please do not take that as complaining, just as reporting the behaviour - and I do not always know if actually the plugin is responsible for a particular behaviour, or the theme, or me.

My test installation, 2.01, Next theme:

http://efg-test.xf1.de/index.php?/pages ... tform.html

My contactform does display fields for name, e-mail, homepage and comment.

Name and comment are marked with a star, hence visibly mandatory - but e-mail seems mandatory too, but has no star.

However, the e-mail check behaves differently from the checks for name and comment: if I try to send a totally empty message, the message "fill out this field" (in German) appears next to the field name, while the screen scrolls up to that field (sadly, not to the label right above it, which gets cut off, so a user has to minimally scroll to see it).

Same if I put something into name only, then try to send -- "fill out this field" next to the comment field. However, after writing into that, and trying again to send, I get a red bar with: "Name, E-Mail und Nachricht dürfen nicht leer gelassen werden" ("...are not allowed to stay empty") no "fill out this field"-tooltip.

So, besides the fact that E-Mail does not have an asterisk, so the poor user has no chance to know it is mandatory, and besides the fact that the last error text calls for a text in Nachricht, whereas the field is actually labeled Kommentar instead of Nachricht: Why this difference in error handling?

Also, after successfully sending with the contactform, the form displays an empty (except an "ok-icon") green bar, like the blue bars on the form input page or the red "give-me-your-e-mail" bar. Other than those, which contain text, this bar has the text "your message has been sent!!" (yes, 2 exclamation marks) displayed below it, not inside the bar. Is this the intended behaviour?

And, is it intended that the page with this stuff (the one you see after successfully sending) also displays, above it, the full content of my static starting page? It is short in this test installation, but will become considerably longer.

Thanks for reading through this, thanks even more for helpful answers.

Regards,

Bernd

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

Re: Questions about contactform plugin

Post by yellowled » Sun May 10, 2015 11:14 am

kybernator wrote:Name and comment are marked with a star, hence visibly mandatory - but e-mail seems mandatory too, but has no star.
Judging from the markup, email is not a required field here. These are determined by the required fields set for comment forms in the spamblock plugin. (Yes, even if you don't use comments.)
kybernator wrote:However, the e-mail check behaves differently from the checks for name and comment:
These are browser-internal validations which in this case look if the required fields are empty.
kybernator wrote:However, after writing into that, and trying again to send, I get a red bar with: "Name, E-Mail und Nachricht dürfen nicht leer gelassen werden" ("...are not allowed to stay empty") no "fill out this field"-tooltip.
That, on the other hand, is a message generated by the contact form plugin. Do you have email set to be a required field in the spamblock plugin? Does the contact form send correctly if you enter an email address?
kybernator wrote:besides the fact that the last error text calls for a text in Nachricht, whereas the field is actually labeled Kommentar instead of Nachricht: Why this difference in error handling?
In order to avoid repetition and save resources, I guess. We always try to not duplicate functionality, so if something can be handled by code that already exists, use that. I think that's what's happening here with comments and contact form mails. Technically, a contact form mail is processed like a comment.
kybernator wrote:Also, after successfully sending with the contactform, the form displays an empty (except an "ok-icon") green bar, like the blue bars on the form input page or the red "give-me-your-e-mail" bar. Other than those, which contain text, this bar has the text "your message has been sent!!" (yes, 2 exclamation marks) displayed below it, not inside the bar. Is this the intended behaviour?
It is probably a bug. Might be a typo in one of the .tpl files not closing an element correctly.
kybernator wrote:And, is it intended that the page with this stuff (the one you see after successfully sending) also displays, above it, the full content of my static starting page? It is short in this test installation, but will become considerably longer.
I think I have seen this before, that the contact form behaves weirdly if a static pages is used as the starting page, but I can't remember why or how to solve that. It might be a question of which plugin is placed first in the event plugin list, static pages or contact form?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
kybernator
Regular
Posts: 126
Joined: Sat Sep 22, 2012 10:15 pm

Re: Questions about contactform plugin

Post by kybernator » Sun May 10, 2015 1:50 pm

yellowled wrote:
kybernator wrote:And, is it intended that the page with this stuff (the one you see after successfully sending) also displays, above it, the full content of my static starting page? It is short in this test installation, but will become considerably longer.
I think I have seen this before, that the contact form behaves weirdly if a static pages is used as the starting page, but I can't remember why or how to solve that. It might be a question of which plugin is placed first in the event plugin list, static pages or contact form?
YL
Thanks for the long answer, I will look into that later - just a short feedback on the last item, the behaviour was indeed caused by the contact form plugin being placed after static pages - I reversed that order, and contactform now behaves as expected after sending in this regard, i.e. not including the startpage in its feedback. Good call!

User avatar
kybernator
Regular
Posts: 126
Joined: Sat Sep 22, 2012 10:15 pm

Re: Questions about contactform plugin

Post by kybernator » Sun May 10, 2015 2:29 pm

yellowled wrote:
kybernator wrote:However, after writing into that, and trying again to send, I get a red bar with: "Name, E-Mail und Nachricht dürfen nicht leer gelassen werden" ("...are not allowed to stay empty") no "fill out this field"-tooltip.
That, on the other hand, is a message generated by the contact form plugin. Do you have email set to be a required field in the spamblock plugin?
No. "Pflichtfelder" (mandatory fields) only includes name,comment - there seems to be no other settings in spamblock where this could be done, right?
Does the contact form send correctly if you enter an email address?
Yes.

(...)
kybernator wrote:Also, after successfully sending with the contactform, the form displays an empty (except an "ok-icon") green bar, like the blue bars on the form input page or the red "give-me-your-e-mail" bar. Other than those, which contain text, this bar has the text "your message has been sent!!" (yes, 2 exclamation marks) displayed below it, not inside the bar. Is this the intended behaviour?
It is probably a bug. Might be a typo in one of the .tpl files not closing an element correctly.
OK, I see. Bug in the plugin itself, then, right? So I could kindly ask Garv to look into that, then. Where would the double exclamation mark hide in the files, do you think?

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

Re: Questions about contactform plugin

Post by yellowled » Sun May 10, 2015 2:41 pm

kybernator wrote:No. "Pflichtfelder" (mandatory fields) only includes name,comment - there seems to be no other settings in spamblock where this could be done, right?
That should be the one. Try adding email (not sure if that's how it's supposed to be entered in the plugin config) there. Personally, I think email as a required field makes sense for contact forms anyway – how else would you reply? Why would you send mail if you didn't want a reply?

It is pretty odd that it sends the email anyway, though. No idea why that is.
kybernator wrote:Bug in the plugin itself, then, right? So I could kindly ask Garv to look into that, then. Where would the double exclamation mark hide in the files, do you think?
Not necessarily, it could just as well be a typo in the .tpl file for Next. I will check that out.

The double exclamation mark is probably just part of the lang constant that's used there. You know how some people on the interwebs think using multiple punctuation mark is a sign of emphasis? I assume it's that.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
kybernator
Regular
Posts: 126
Joined: Sat Sep 22, 2012 10:15 pm

Re: Questions about contactform plugin

Post by kybernator » Sun May 10, 2015 3:11 pm

yellowled wrote:The double exclamation mark is probably just part of the lang constant that's used there. You know how some people on the interwebs think using multiple punctuation mark is a sign of emphasis? I assume it's that.
Dangerous ground, of course. Terry Pratchett wrote: "Five exclamation marks, the sure sign of an insane mind." - and we are already 40% there :D

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

Re: Questions about contactform plugin

Post by yellowled » Sun May 10, 2015 4:26 pm

yellowled wrote:The double exclamation mark is probably just part of the lang constant that's used there.
It's astounding how much I have forgotten about various plugins. That text is not a lang constant (well, technically it is), you can edit it to your liking in the contact form plugin's options (and remove the extra exclamation mark there).

Not sure how the confirmation message gets screwed up, though. In my dev blog, it's displayed properly. Do you mind if I test that in your test blog?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
kybernator
Regular
Posts: 126
Joined: Sat Sep 22, 2012 10:15 pm

Re: Questions about contactform plugin

Post by kybernator » Sun May 10, 2015 5:06 pm

yellowled wrote:
yellowled wrote:The double exclamation mark is probably just part of the lang constant that's used there.
It's astounding how much I have forgotten about various plugins. That text is not a lang constant (well, technically it is), you can edit it to your liking in the contact form plugin's options (and remove the extra exclamation mark there).
D'oh!! :-)
Not sure how the confirmation message gets screwed up, though. In my dev blog, it's displayed properly. Do you mind if I test that in your test blog?
Not at all, be my guest. Shall I send username/pw?

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

Re: Questions about contactform plugin

Post by yellowled » Sun May 10, 2015 5:51 pm

kybernator wrote:Not at all, be my guest. Shall I send username/pw?
Nope, just ignore my test mail.

Questions:

1. Do you have a <p></p> wrapping your contact form confirmation text in the contact form options? If so, please remove it. Text only, it's not supposed to be wrapped in HTML.
2. If not, you probably still have a markup plugin activated which is wrapping the text in <p></p> here?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Questions about contactform plugin

Post by Timbalu » Sun May 10, 2015 6:14 pm

The double EXMARK is in the lang constant. The lang constant is pasted into the second textarea field. This field is a html field. CKEDITOR on change or submit, will add <p> tags. I can't remember this field has changed from text to html at some point. 2k11 has the same behaviour. The origin tpl file was a div, which would include the p styled message, I assume. You may remove the p tags in sourcecode view and submit there. Then all is fine.

Edit: The funny thing is CKE plugin does spawn them both, while core CKE does not. Can't say why yet.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

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

Re: Questions about contactform plugin

Post by yellowled » Sun May 10, 2015 9:13 pm

Timbalu wrote:The funny thing is CKE plugin does spawn them both, while core CKE does not. Can't say why yet.
I seem to recall (from ProcessWire) that there is a setting in or a plugin for CKE which automagically wraps everything in <p> elements or replaces <div> with <p> or something like that? Some kind of p-related option in CKE. Maybe that is set in one, but not in the other?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
kybernator
Regular
Posts: 126
Joined: Sat Sep 22, 2012 10:15 pm

Re: Questions about contactform plugin

Post by kybernator » Sun May 10, 2015 10:23 pm

OK, the "message sent"-text was indeed displayed in CKEditor, and source code view showed that it had added p tags - I removed those, and the text appeared within the green bar.

Mystery solved, thank you.

Edit: Oh, and of course, the moment you configure anything in the plugin, the p tags are there again, unless you remove them manually.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Questions about contactform plugin

Post by Timbalu » Mon May 11, 2015 12:04 pm

kybernator wrote:Edit: Oh, and of course, the moment you configure anything in the plugin, the p tags are there again, unless you remove them manually.
Yes, this is what I meant with "submit there".
yellowled wrote:
Timbalu wrote:The funny thing is CKE plugin does spawn them both, while core CKE does not. Can't say why yet.
I seem to recall (from ProcessWire) that there is a setting in or a plugin for CKE which automagically wraps everything in <p> elements or replaces <div> with <p> or something like that? Some kind of p-related option in CKE. Maybe that is set in one, but not in the other?
You have misinterpreted my called "them". I meant both textareas (html) fields. :wink:

It is a "bug" in core wysiwyg initiation. I have described several times that we had three kinds of slight different textarea wysiwyg inits. The one for blog entries, the one for staticpages and other wysiwyg-hook related plugins and the one for other nugget plugins. The latter were called by the js function Spawnnugget() { /* init plugin nuggets when not using the default wysiwyg-editor */ ... correctly, in case of Plugin Editors.
For the contactform, well, this missing instance for the second textarea fields does not really matter, since the second textarea (for the success message) would probably not need a html editor in most cases and has this p issue with 2k11/next messages. But it be nice, if it would work correct here too and probably also for other multiple field nuggets (plugins).

I found an easy solution by setting nugget case spawnMulti to true and using the upper called Spawnnugget() js function not being initiated by core CKE instances. Any thoughts?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

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

Re: Questions about contactform plugin

Post by yellowled » Mon May 11, 2015 1:34 pm

Timbalu wrote:You have misinterpreted my called "them". I meant both textareas (html) fields. :wink:
Honestly, I just posted what came to my mind and seemed potentially related and/or helpful. :)
Timbalu wrote:For the contactform, well, this missing instance for the second textarea fields does not really matter, since the second textarea (for the success message) would probably not need a html editor in most cases and has this p issue with 2k11/next messages.
Do we “have to” change the span to a div here (or everywhere where it's possible that the span could contain HTML? (It's not out of the question, just a little bit … <german>zähneknirschend</german>)
Timbalu wrote:I found an easy solution by setting nugget case spawnMulti to true and using the upper called Spawnnugget() js function not being initiated by core CKE instances. Any thoughts?
I never fully understood the whole “spawn the WYSIWYG editor” part of out core JS, that's more onli's part. onli, thoughts?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Questions about contactform plugin

Post by Timbalu » Mon May 11, 2015 2:06 pm

yellowled wrote:Do we “have to” change the span to a div here (or everywhere where it's possible that the span could contain HTML? (It's not out of the question, just a little bit … <german>zähneknirschend</german>)
Its not the span - its the p, which kicks that out.

Code: Select all

<p class="msg-success"><span class="icon-ok-circled" aria-hidden="true"></span> {$plugin_contactform_sent}</p>
Do you have more instances in mind where this could happen?
Saying "have to" would mean to prevent innovation. I think 2k11 and next are examples of future themes. Fixing the cores second textarea would add that p tag in wysiwyg mode and most people would possibly never notice. I'd say: either change back to div, or use {$plugin_contactform_sent|replace:'<p>':''|replace:'</p>':''}
Or as a third possibillity use 'text' instead of 'html' for that field in contactform. Wouldn't there be a css only solution too?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Post Reply