Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#811 2010-07-08 15:43:22

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: zem_contact_reborn 4.0.3.20

I am working on a really basic order form using ZCR. There are two products in the form and both use zem_contact_text fields to specify the quantity requested. I decided to use the jquery calculation plugin to calculate and display the total cost (based on the quantities entered in the form). The total shows up in the DOM inside this table cell: <td align=“right” id=“grandTotal”> </td>

Now I can’t figure out how to get the total to pass into the email that is sent to me and copied to sender. The total isn’t in an input field and it is calculated on the fly with javascript as the quantities change (before the form is submitted). I tried using zem_contact_secret as a container to capture it, but that obviously didn’t work (I didn’t really expect it to). I am in over my head and this might not be an appropriate question for this forum, but I thought I’d go for it in case anyone else has a similar issue trying to pass something like this into a ZCR form.

Offline

#812 2010-07-08 16:11:25

datorhaexa
Member
From: Düsseldorf, Germany
Registered: 2005-05-23
Posts: 115
Website

Re: zem_contact_reborn 4.0.3.20

Hi there! Not sure if this can help, but I threw a google search and gave me this

As far as I see, he passes a hidden value along so maybe you can use the method.

Offline

#813 2010-07-08 17:00:18

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

zem_contact_secret won’t help you, because that is completely hidden from the client side.

You could use a zem_contact_text field and store the value in there. Using CSS and Javascript, you can either hide the field (display:none) or make it read-only (for the user).

Offline

#814 2010-07-08 17:19:16

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: zem_contact_reborn 4.0.3.20

zem_contact_secret is hidden on the screen, but shows in the mail.

Offline

#815 2010-07-08 17:22:41

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

I know it does, but you can’t use it to pass information that is generated on the client side.

Offline

#816 2010-07-08 17:38:16

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: zem_contact_reborn 4.0.3.20

Sorry, I didn’t tell all my thoughts :) What I meant was :
  • using forms areas for the quantities
  • using any container to display the result
  • using the secret field to store and send the result in the mail (but it may be where I’m wrong)

Last edited by CeBe (2010-07-08 17:39:22)

Offline

#817 2010-07-08 17:54:23

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

The zem_contact_secret field won’t work for what you have in mind, because you’re calculating the costs using jQuery, so that happens in the visitor’s browser, while zem_contact_secret contents never reach the browser, so you can’t store anything in there that you want to modify in the browser on the client side.

Solution: use another zem_contact_text for storing the results of the costs calculation. You can style that field to match your needs.

Offline

#818 2010-07-08 20:18:28

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: zem_contact_reborn 4.0.3.20

Thank you all for these suggestions! The zem_contact_text field does work , but not all the way… I can see the total updating in the text field in the DOM via firebug — but it doesn’t actually go through to the email. ZCR treats it as if no value was entered. I’ll explore the link that datorhaexa suggested and will see if there is a way to get it to pass through.

Update: It works perfectly. I just had to carefully read the solution that datorhaexa pointed me to here

I gave a zem_contact_text tag the correct name/label to match the id in the jquery calc code:

<div style="visibility:hidden"><txp:zem_contact_text name="Total" label="Total" required="0" break="" /></div>

Added this to the jquery calc code (make sure to put “.val” instead of “.text”:

$("#Total").val(
// round the results to 2 digits
"$" + sum.toFixed(2)
);

Thanks again!

Last edited by photonomad (2010-07-08 20:38:26)

Offline

#819 2010-07-15 04:51:16

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: zem_contact_reborn 4.0.3.20

I have an input field that I don’t want to supply a ‘label’ – but when I receive an email, naturally there is no ‘label:’ in the output, just the value provided by the user

<txp:zem_contact_text label="" label="House Number" required="1" break="" /> - <txp:zem_contact_text name="House-Number-End-Range" label="" required="0" break="" />

Result, in email:

House Number: 123

: 456

I thought ‘name’ might supply this when a ‘label’ attribute wasn’t specified, but that doesn’t seem to be the case

can you suggest a workaround?

(I could give it a label, and hide it with CSS, for example)

Offline

#820 2010-07-15 16:50:23

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

This will add a label for the email only and not show the label on the website:

<txp:zem_contact_reborn ...>
  <txp:zem_contact_text name="myname" label="" />
  <txp:php>
    global $zem_contact_labels;
    $zem_contact_labels['myname'] = 'Label_that_will_be_used_in_the_email';
  </txp:php>
</txp:zem_contact_reborn>

Offline

#821 2010-07-16 01:11:30

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: zem_contact_reborn 4.0.3.20

Thank you Ruud, perfect

Offline

#822 2010-07-18 23:48:50

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 743

Re: zem_contact_reborn 4.0.3.20

Ruud, am looking at processing email responses with an ASP script to update a database (external to Textpattern). I could edit the plugin code to make the labels & responses more like XML (so each is clearly defined); has someone done this already? Any comments or suggestions?

Offline

#823 2010-07-19 10:05:11

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

Instead of editing the plugin, use the ‘zemcontact.submit’ callback event.

Offline

#824 2010-07-19 13:34:47

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

Re: zem_contact_reborn 4.0.3.20

funtoosh schrieb:


i have a question on using the (great!) user selectable recipient feature with ZCR

hi again,
i have a follow-up question to making use of a dropdown for recipients with ZCR — i was trying to generate my list of recipients from txp, which i thought should look sth. like this:

<txp:php>
  $title = title (array ());
  $email = custom_field (array ('name' => 'Email'));
  global $zem_contact_form;
  switch($zem_contact_form['Adressat'])
  {
     case '$title':
      echo '$email';
      break;
    default:
      echo 'test@example.com';
  }
</txp:php>

it’s not working though ;—(
any ideas on where i went wrong?

cheers,
enjoy the summer heat,
-f

Last edited by funtoosh (2010-07-19 13:35:42)

Offline

#825 2010-07-19 15:36:05

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

Re: zem_contact_reborn 4.0.3.20

uhm, i guess i’d have to wrap my

    case '$title':
      echo '$email';
      break;

in the equivalent of a custom_article to loop thru all articles, wouldn’t i?

Offline

Board footer

Powered by FluxBB