Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1246 2012-10-17 16:28:00

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,387
Website GitHub Mastodon Twitter

Re: zem_contact_reborn 4.0.3.20

I am building a form with many fields which will need to be filled multiple times by those who will be using it.

I was wondering if some of the info for some of the fields (namely: name, Surname, Email, telephone, city & country) could be kept in a cookie and refilled automatically. I know about the auto-fill function of most browsers but I cannot count on that as I know that many people who will be filling the form do not have it enabled.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#1247 2012-10-19 01:27:29

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: zem_contact_reborn 4.0.3.20

How long does the information need to be kept? And how often does it need to be updated?

If it’s a lot, then an alternative approach is actually to store it in the database and then recall it. For example, this is the approach I have taken before:

  • create a new table specifically for the data,
  • use mem_simple_form to allow users to enter data, and
  • use smd_query to extract existing data from the table (if it exists) and prepopulate the fields for editing.

The only thing this solution doesn’t do is send an email at the end. If you really need the email, then you could modify mem_simple_form to do so. Otherwise, once the data is in a table then it’s pretty easy to use smd_query to produce reports.

Offline

#1248 2012-10-19 09:25:49

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

Re: zem_contact_reborn 4.0.3.20

colak wrote:

I am building a form with many fields which will need to be filled multiple times by those who will be using it.

I was wondering if some of the info for some of the fields (namely: name, Surname, Email, telephone, city & country) could be kept in a cookie and refilled automatically. I know about the auto-fill function of most browsers but I cannot count on that as I know that many people who will be filling the form do not have it enabled.

This can be achieved with a little editing of ZCR and with the addition of adi_gps.

ZCR clears the POST variables as soon as it has successfully sent the email with the form contents, so you need to save those variables first before the array is wiped. This happens at line 231 in ZCR.

There are two ways of doing this:

1. Insert a call to adi_gps() just before line 231, so replace this:

$_POST = array();

with this:

adi_gps();

$_POST = array();

This will save the POST variables to new Textpattern variables, one for each of the POST variables. You can now use the values of these variables to pre-populate the respective fields in the new form.

2. Insert a new callback into ZCR just before line 231. This enables you to create a new plugin to use this callback to process the captured values in anyway you please before they are wiped. I have used this in the past to submit captured values to a Zoho CRM database in addition to an email being sent.

Replace this:

$_POST = array();

with this:

callback_event('zemcontact.success');

$_POST = array();

You can then add the following line in your plugin code to call the chosen function when the callback event happens:

register_callback('my_function_name','zemcontact.success');

And put the appropriate code to process the POST variables in your function.

Hope this helps.

Offline

#1249 2012-11-09 08:58:55

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

Re: zem_contact_reborn 4.0.3.20

putted code below into article. it sends the data, but “thank’s” text won’t show up and form itself doesn’t disapper. any idea, why? because code is in article?

<txp:zem_contact to="name@gmail.com" label="Send answers" subject="Survey" thanks="Thank's.">
<txp:zem_contact_text label="Question 1" break="" />
<txp:zem_contact_text label="Question 2" break="" />
<txp:zem_contact_text label="Name" break="" />
<txp:zem_contact_email label="E-mail" break="" />
<txp:zem_contact_submit label="Send" />
</txp:zem_contact>

Offline

#1250 2012-11-09 09:14:05

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,387
Website GitHub Mastodon Twitter

Re: zem_contact_reborn 4.0.3.20

I wonder if the apostrophe is messing it up.
Try

<txp:zem_contact to="name@gmail.com" label="Send answers" subject="Survey" thanks="Thanks.">
<txp:zem_contact_text label="Question 1" break="" />
<txp:zem_contact_text label="Question 2" break="" />
<txp:zem_contact_text label="Name" break="" />
<txp:zem_contact_email label="E-mail" break="" />
<txp:zem_contact_submit label="Send" />
</txp:zem_contact>

It’s also more grammatically correct.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#1251 2012-11-09 12:01:46

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

Re: zem_contact_reborn 4.0.3.20

didn’t help

Offline

#1252 2012-11-09 12:07:15

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: zem_contact_reborn 4.0.3.20

What about the full stop in the name of the ‘thanks’ form?

Offline

#1253 2012-11-09 12:16:26

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

Re: zem_contact_reborn 4.0.3.20

found. it’s because modified textile i’m using… :(

Offline

#1254 2012-11-12 13:03:15

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

Re: zem_contact_reborn 4.0.3.20

ruud wrote:

You can change that line to:

safe_insert('txp_discuss_nonce', "issue_time = (now() + 20 MINUTE), nonce = '$zem_contact_nonce'");

That would increase the timeout from the default 10 minutes to 10 + 20 = 30 minutes.

Does this modification still apply to the current version of the plugin?

Offline

#1255 2012-11-12 17:51:28

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

@masa: yes, it still applies.

Offline

#1256 2012-11-12 18:23:28

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

Re: zem_contact_reborn 4.0.3.20

Perfect!

Thanks, Ruud.

Offline

#1257 2012-11-14 17:33:50

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

Re: zem_contact_reborn 4.0.3.20

Hi Ruud,

it’s not working. I tried two variations…

safe_insert('txp_discuss_nonce', "issue_time = (now() + 20 MINUTE), nonce = '$zem_contact_nonce'");

and without brackets:

safe_insert('txp_discuss_nonce', "issue_time = now() + 20 MINUTE, nonce = '$zem_contact_nonce'");

Both break the form: I now immediately get the error message saying “the form has expired”.

Any ideas?

Offline

#1258 2012-11-14 20:04:06

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

Try this:

safe_insert('txp_discuss_nonce', "issue_time = date_add(now(), interval 20 minute), nonce = '$zem_contact_nonce'");

Offline

#1259 2012-11-20 08:39:34

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 243
Website

Re: zem_contact_reborn 4.0.3.20

I’d like to suggest this small modification to a function:

function zem_contact_send_article($atts)
{
if (!isset($_REQUEST['zem_contact_send_article'])) {
$linktext = (empty($atts['linktext'])) ? zem_contact_gTxt('send_article') : $atts['linktext'];
$join = (empty($_SERVER['QUERY_STRING'])) ? '?' : '&';
$href = $_SERVER['REQUEST_URI'].$join.'zem_contact_send_article=yes';
return '<a href="'.htmlspecialchars($href).'">'.htmlspecialchars($linktext).'</a>';
}
return;
}

It might be better to be like this:

function zem_contact_send_article($atts)
{
if (!isset($_REQUEST['zem_contact_send_article'])) {
$linktext = (empty($atts['linktext'])) ? zem_contact_gTxt('send_article') : $atts['linktext'];
$join = (empty($_SERVER['QUERY_STRING'])) ? '?' : '&';
$href = $_SERVER['REQUEST_URI'].$join.'zem_contact_send_article=yes';
return '<p><a href="'.htmlspecialchars($href).'" rel="nofollow">'.htmlspecialchars($linktext).'</a></p>';
}
return;
}

{Edited to add bc. for better code display. – Uli}

Last edited by uli (2012-11-20 11:39:46)

Offline

#1260 2012-11-26 12:56:15

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

Re: zem_contact_reborn 4.0.3.20

why i’m getting this error?

Notice: Undefined offset: 8192 in /srv/n1/w/eoy/afatar/html/nurmkana/textpattern/lib/txplib_misc.php on line 680
Tag error:  <txp:zem_contact_select label="Department" list=",Marketing,Sales,Support" /> ->  : Function split() is deprecated while parsing form “tagasiside” on page “default”
textpattern/lib/txplib_misc.php(812) : eval()'d code:539 split()
textpattern/lib/txplib_publish.php:421 zem_contact_select()
textpattern/lib/txplib_publish.php:321 processTags()
textpattern/lib/txplib_misc.php(812) : eval()'d code:95 parse()
textpattern/lib/txplib_publish.php:421 zem_contact()
textpattern/lib/txplib_publish.php:334 processTags()
textpattern/lib/txplib_misc.php:1974 parse()
textpattern/publish/taghandlers.php:305 parse_form()
textpattern/lib/txplib_publish.php:421 output_form()
textpattern/lib/txplib_publish.php:321 processTags()

Notice: Undefined offset: 8192 in /srv/n1/w/eoy/afatar/html/nurmkana/textpattern/lib/txplib_misc.php on line 685

Offline

Board footer

Powered by FluxBB