Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#496 2008-11-20 16:00:51

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

Christophe, that would break quite a few plugins that currently rely on the current location of the zemcontact.submit callback event (after $zem_contact_error is used).
Instead of using the spam callback event, you may want to consider creating a tag that can be used inside a ZCR form, especially since you have plans to conditionally display a captcha.

Offline

#497 2008-11-21 02:02:37

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: zem_contact_reborn 4.0.3.20

Ruud, sorry but I don’t understand what would break if we add a second check of the $zem_contact_error array after calling the spam plugins. The validation process would be like that:

1) Process the form and its fields (as always).
2) Check $zem_contact_error to determine if some fields where not entered correctly in the form. If the array is not empty, display the errors, trigger a form reload, then stop. If the array is empty, move on. (as always)
3) Call the spam plugins. If the spam flag was set, display the spam error then stop. Otherwise we move on. (as always)
4) NEW: Check the $zem_contact_error array again to determine if a spam plugin added something to it. If it’s the case, display the errors, trigger a form reload, then stop. If the array is still empty, move on.
5) Send the mail.

Does this process look OK to you? If not, what would break and how?

I don’t want to create a new tag for zem_contact_reborn and force the users to adapt their form for a plugin when there’s a special callback to add antispam things to the form automatically, but if you think there’s no other way to do it, I’ll need to use this way.

Last edited by cbeyls (2008-11-21 02:04:52)


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#498 2008-11-21 09:45:35

Gallex
Member
Registered: 2006-10-08
Posts: 1,331

Re: zem_contact_reborn 4.0.3.20

cbeyls wrote:

Gallex, try this (it will degrade nicely if javascript is disabled):

Christophe, that code will open a whole page, but i would like only the ordering form, is this possible?

i don’t know, wrappig this <txp:output_form form=“ordering” /> into javascript somehow….?

p.s. “ordering” is my ordering form name under forms tab

Offline

#499 2008-11-21 12:49:30

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

Christophe, I think it’s an ugly hack.

Offline

#500 2008-11-21 17:15:45

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: zem_contact_reborn 4.0.3.20

Gallex,

You need to create a new section, like order_popup, then associate it with a section template which contains only the ZCR form with minimal HTML. Then open this section URL using the javascript popup link. That way, you’ll only have the form inside the popup.

Ruud,

I know it’s not the most elegant way of doing things but what’s the ugliest hack: creating a fake tag for usage in a ZCR form that will modify the $zem_contact_error array, or allowing the spam check callbacks to modify it directly and check it again afterwards?

Furthermore, creating a new ZCR form tag would not work for me because in my plugin, not only the CAPTCHA validation does trigger a form reload, the spam check itself does it also. And the spam check must be performed after the form validation when all fields are properly filled, not during validation.

So really, feel free to do it any way you want. I just need a way to trigger a form reload after the form was validated like you can do for Textpattern comments already, nothing more. Please, just find a way that you judge clean to add things to the antispam API to do this. There is no reason why it would break the existing plugins as long as you keep the existing API functions untouched and give them the highest priority.

Otherwise I would have no choice than just dropping Mollom support for ZCR which is a shame because it’s currently more vulnerable to spam than the comment forms.


My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#501 2008-11-21 22:10:26

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: zem_contact_reborn 4.0.3.20

Does any of this help at all?

Offline

#502 2008-11-22 15:11:47

Gallex
Member
Registered: 2006-10-08
Posts: 1,331

Re: zem_contact_reborn 4.0.3.20

cbeyls wrote:

You need to create a new section, like order_popup, then associate it with a section template which contains only the ZCR form with minimal HTML. Then open this section URL using the javascript popup link. That way, you’ll only have the form inside the popup.

perfect! thank you christophe.
could you only explain me, why the second one (below the content) don’t act like the first one? i’m using exactly the same javascript code for both

Last edited by Gallex (2008-11-22 15:12:17)

Offline

#503 2008-11-23 11:12:09

cbeyls
Archived Plugin Author
From: Brussels, Belgium
Registered: 2005-09-12
Posts: 136
Website

Re: zem_contact_reborn 4.0.3.20

Gallex wrote:

could you only explain me, why the second one (below the content) don’t act like the first one? i’m using exactly the same javascript code for both

id attribute values must be unique in the HTML page. If two tags have the same id, document.getElementById() will always return the first one. So I suggest you change the id of the first button to orderbutton1 and the id of the second button to orderbutton2, for example. Furthermore, you can use a single javascript for both. Like this:

<p class="tellimine"><a href="http://www.eestimahe.ee/ordering" class="order" id="orderbutton1">Order &gt;</a>Kõikide oma toodete tellimiseks klikkige nupule "Telli"</p>
<p class="tellimine"><a href="http://www.eestimahe.ee/ordering" class="order" id="orderbutton2">Order &gt;</a>Kõikide oma toodete tellimiseks klikkige nupule "Telli"</p>
<script type="text/javascript">
document.getElementById("orderbutton1").onclick = document.getElementById("orderbutton2").onclick = function() {
   window.open(this.href, "order_form", "menubar=no,status=no,resizable=yes,scrollbars=yes,width=550,height=380");
   return false;
}
</script>

My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)

Offline

#504 2008-11-23 13:38:10

Gallex
Member
Registered: 2006-10-08
Posts: 1,331

Re: zem_contact_reborn 4.0.3.20

great! thank you very much Christophe

Offline

#505 2008-12-04 12:23:43

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: zem_contact_reborn 4.0.3.20

maybe someone have already do this request but I don’t find the answer.

I must send an Email with a table inside, and I need that the mail has content Type: text/html.

Can i do that? How?

Offline

#506 2008-12-04 17:31:33

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

ZCR is currently setup to handly only plain text email. No plans to change that on my end.

Offline

#507 2008-12-04 18:04:34

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: zem_contact_reborn 4.0.3.20

I am testing out my form. I set the email, first and last name fields to required. I filled out all 3 fields and yet I still get the error below. Any reason why?

  • Required field, “First Name”, is missing.
  • Required field, “Last Name”, is missing.

<txp:zem_contact_text label="First Name" name="First name" required="1" min="2" max="40" /><br />
<txp:zem_contact_text label="Last Name" name="Last Name" required="1" min="2" max="40" /><br />
<txp:zem_contact_email required="1" /><br />
<txp:zem_contact_text label="Company or Organization" name="Company" required="0" min="2" max="40" /><br />
<txp:zem_contact_text label="Phone" min=7 max=15 required="0" /><br />
<txp:zem_contact_text label="Mobile" min=7 max=15 required="0" /><br />
<txp:zem_contact_text label="Website URL" name="Website" required="0" min="2" max="40" /><br />
<txp:zem_contact_textarea label="Comments" cols="40" rows="10"  /><br />
<txp:zem_contact_select break="br" label="How did you hear of us?" list="Word of Mouth, Search Engine, Blog, Article, Advertisement, Direct Mail, Press Release" /><br />
<txp:zem_contact_text label="Other" name="Company" required="0" min="2" max="40" /><br />
<br />
<txp:zem_contact_submit label="Submit" />

Offline

#508 2008-12-04 18:30:44

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

It’s probably the use of spaces in the name attribute.

Offline

#509 2008-12-04 20:21:26

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: zem_contact_reborn 4.0.3.20

Hu Ruud,

I made a local modification to zem_contact_reborn that you might want to consider adding to the official plugin code.

I use select menus in my contact forms. I like to use a header item like “Please choose…” as the default (top-most) item. However, I also want to force the user to make a choice (i.e. make the field “required”). Unfortunately, the plugin sees the header item as a valid choice since it is not “empty.” My patch fixes this by adding an optional attribute “has_header_item.” The change is in the zem_contact_select() function as follows:

function zem_contact_select($atts)
{
	global $zem_contact_error, $zem_contact_submit;

	extract(zem_contact_lAtts(array(
		'name'			=> '',
		'break'			=> ' ',
		'delimiter'		=> ',',
		'isError'		=> '',
		'label'			=> zem_contact_gTxt('option'),
		'list'			=> zem_contact_gTxt('general_inquiry'),
		'required'		=> 1,
		'selected'		=> '',
		'has_header_item'	=> 0,
	), $atts));

	if (empty($name)) $name = zem_contact_label2name($label);

	$list = array_map('trim', split($delimiter, preg_replace('/[\r\n\t\s]+/', ' ',$list)));

	if ($zem_contact_submit)
	{
		$value = trim(ps($name));
		if ($has_header_item && ($value == $list[0]))
		{
			$value = '';
		}

Offline

#510 2008-12-04 20:30:12

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: zem_contact_reborn 4.0.3.20

ruud wrote:

It’s probably the use of spaces in the name attribute.

Yep- it’s the use of spaces. It doesn’t allow for spaces in the name attribute so I just make it one word instead of two. Thx.

Offline

Board footer

Powered by FluxBB