Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#493 2008-11-18 22:35:44

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: zem_contact_reborn 4.0.3.20

OK – I fixed this :)

One line 621 find the following code

	return '<input type="checkbox" id="'.$name.'" class="zemCheckbox '.$zemRequired.$isError.'" name="'.$name.'"'.
	($value ? ' checked="checked"' : '').' />'.$break.
	'<label for="'.$name.'" class="zemCheckbox '.$zemRequired.$isError.' '.$name.'">'.htmlspecialchars($label).'</label>';

and replace with this

return '<label for="'.$name.'" class="zemCheckbox '.$zemRequired.$isError.' '.$name.'">'.htmlspecialchars($label).'</label>'.$break.
	'<input type="checkbox" id="'.$name.'" class="zemCheckbox '.$zemRequired.$isError.'" name="'.$name.'"'.
		($value ? ' checked="checked"' : '').' />';

All I did was reverse the label and input tags… not sure if it was the right way to go about things… but it worked :)

Offline

#494 2008-11-20 11:01:43

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

Re: zem_contact_reborn 4.0.3.20

i’ll try again…

i have a product page with “order” button at the end which directs customer to ordering page when he hits it. but i very much need this ordering form to open in a popup window when customer hits the button “order”

is this doable? ruud, anybody?

i guess it needs a little javascript…

Offline

#495 2008-11-20 14:16:44

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

Re: zem_contact_reborn 4.0.3.20

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

<p class="tellimine"><a href="http://www.eestimahe.ee/ordering" class="order" id="orderbutton">Order &gt;</a></p>
<script type="text/javascript">
document.getElementById("orderbutton").onclick = function() {
   window.open(this.href, "order_form", "menubar=no,status=no,resizable=yes,scrollbars=yes,width=700,height=500");
   return false;
}
</script>

Ruud, could you modify ZCR code so that the $zem_contact_error array is checked again after the spam plugins are loaded in order to trigger a form reload? Thank you.


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

#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,304

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,304

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,304

Re: zem_contact_reborn 4.0.3.20

great! thank you very much Christophe

Offline

Board footer

Powered by FluxBB