Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-10-15 18:07:22

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Quick quote with ZRC with transfering to more detailed form

Hello TXP experts!
I would like to use ZCR to make a quick quote form with a few fileds like name and email. After iserting his name and email and pushing submit button a site visitor goes to the page with more detailed form to fill but name and email are already there. I saw this forms on some transportation companies sites – they ask you for name & email or phone, you submit them and next you see more fields to fill like cargo, cost, weight, etc…
I appreciate your input.

Offline

#2 2016-10-16 08:10:09

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,559
Website GitHub Twitter

Re: Quick quote with ZRC with transfering to more detailed form

Hi

Maybe you can use a succeed form and put a new zcr forn there? i havent tested but i think it should work.

Cheers.

Offline

#3 2016-10-16 08:58:34

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

Is it called “succeed form”? What should be added to the form to enable it to store the filelds data from the previous page?

Last edited by admi (2016-10-16 09:34:20)

Offline

#4 2016-10-16 10:23:19

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,559
Website GitHub Twitter

Re: Quick quote with ZRC with transfering to more detailed form

Hi

Yes it s the succeed form, for form data there are post variable, only find the exact name to extract using php ps() function or use adi_gps plugin.

I havent used that solution with zcr but with mem_simple_form it works.

Cheers.

Offline

#5 2016-10-16 11:13:03

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

Yes it s the succeed form, for form data there are post variable, only find the exact name to extract using php ps() function or use adi_gps plugin.

How do you combine adi_gps and mem_simple_form? Something like that?

<txp:adi_gps>
txp:zem... or  txp:mem... 
</txp:adi_gps>

Offline

#6 2016-10-16 11:34:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: Quick quote with ZRC with transfering to more detailed form

The problem you’ll hit by splitting the form up this way is that you’ll get two emails per request unless you write a module that hooks into the zemcontact.deliver callback (under zcr 4.5.0.0)

Is JavaScript an option? Split your single form into divs and when you hit ‘next’ some JS hides the previous div and shows the next, which has the submit button on it. Like a wizard. You could copy fields filled in step 1 into placeholder spans in step 2 so they can see what they typed, or provide back buttons to jump to the previous step and allow it to be edited.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#7 2016-10-16 11:59:41

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

Bloke wrote #302232:

The problem you’ll hit by splitting the form up this way is that you’ll get two emails per request unless you write a module that hooks into the zemcontact.deliver callback (under zcr 4.5.0.0)

Is JavaScript an option? Split your single form into divs and when you hit ‘next’ some JS hides the previous div and shows the next, which has the submit button on it. Like a wizard. You could copy fields filled in step 1 into placeholder spans in step 2 so they can see what they typed, or provide back buttons to jump to the previous step and allow it to be edited.

As far as I understand this is taking place on the same page. What about short form on one page and full form on the other?

Offline

#8 2016-10-16 12:52:58

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,559
Website GitHub Twitter

Re: Quick quote with ZRC with transfering to more detailed form

The idea behind 2 forms is to let the user put few inputs and go to the second, then even if he doesn’t fill the full form the webmaster still got some few information then can contact the user using email or other channels, it s a manner to have more visitor information than using one long form.

Offline

#9 2016-10-16 13:32:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,499
Website GitHub

Re: Quick quote with ZRC with transfering to more detailed form

Dragondz wrote #302239:

The idea behind 2 forms is to let the user put few inputs and go to the second, then even if he doesn’t fill the full form the webmaster still got some few information then can contact the user using email or other channels

That’s fine. If you want two emails, it should be possible as you suggest: have a second contact form at the ‘success’ page and then read in the POSTed values via adi_gps and put them in hidden (or visible, pre-filled) fields in the second form.

I don’t think the POSTed values are emptied on the success page, but might be wrong. If they are (perhaps it’s a redirect?), you’ll need to get creative with storing them elsewhere for later retrieval.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#10 2016-10-16 14:43:47

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

Bloke wrote #302241:

That’s fine. If you want two emails, it should be possible as you suggest: have a second contact form at the ‘success’ page and then read in the POSTed values via adi_gps and put them in hidden (or visible, pre-filled) fields in the second form.

I don’t think the POSTed values are emptied on the success page, but might be wrong. If they are (perhaps it’s a redirect?), you’ll need to get creative with storing them elsewhere for later retrieval.

I looked at the code of short forms, there were like this –

<form action="/page-with-full-form">

A visitor goes to next page without sending the data. I don’t see why two emails? Or you mean using adi_gps + ZCR?

Offline

#11 2016-10-16 18:41:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,220
Website GitHub

Re: Quick quote with ZRC with transfering to more detailed form

A visitor goes to next page without sending the data. I don’t see why two emails? Or you mean using adi_gps + ZCR?

What Stef means is that ZCR will by default send an email when you press submit (unless you make a plugin to prevent that), so you’ll get an email for your short form and a second email for your full form. As Dragondz said, that can be useful if you want to get contact details even if someone aborts the full form process, though it’s not great netiquette to do without asking permission.

If you just want to break down the process into steps, how about just using a regular HTML form (no ZCR) for the short form, and ZCR for the full form?
Collect name, email etc. with the regular HTML form and make the form submit to the page where your ZCR full form is. In your template then use adi_gps to capture the POST or GET values sent by the short form into txp:variables. You can then use those variables as tag-in-tags to pre-populate the value attribute of the zcr_ form tags (e.g. text, email or hidden). They’ll then be submitted with the full ZCR form.


TXP Builders – finely-crafted code, design and txp

Online

#12 2016-10-16 18:54:25

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

jakob wrote #302245:

What Stef means is that ZCR will by default send an email when you press submit (unless you make a plugin to prevent that), so you’ll get an email for your short form and a second email for your full form. As Dragondz said, that can be useful if you want to get contact details even if someone aborts the full form process, though it’s not great netiquette to do without asking permission.

If you just want to break down the process into steps, how about just using a regular HTML form (no ZCR) for the short form, and ZCR for the full form?
Collect name, email etc. with the regular HTML form and make the form submit to the page where your ZCR full form is. In your template then use adi_gps to capture the POST or GET values sent by the short form into txp:variables. You can then use those variables as tag-in-tags to pre-populate the value attribute of the zcr_ form tags (e.g. text, email or hidden). They’ll then be submitted with the full ZCR form.

I think about it as the only option. I never used adi_gps though. “In your template” – Do I use adi_gps tags on the page with short form, right?

Offline

#13 2016-10-16 20:04:41

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,220
Website GitHub

Re: Quick quote with ZRC with transfering to more detailed form

admi wrote #302246:

I think about it as the only option. I never used adi_gps though. “In your template” – Do I use adi_gps tags on the page with short form, right?

No, on the page that the short form points to, e.g. in your case the ZCR page.

It works like this: when you fill out an HTML form it sends the results to the destination (action) page either as GET parameters in the URL (e.g.?nombre=admi&email=admi@admi.com) or as POST variables (not visible in the URL) depending on the method you set. POST is the most typical method with forms.

You use adi_gps / rah_gps on the page template where you have your ZCR form to read out the value (e.g. the name or email etc.) passed to that page and store it in a txp variable, which you can then use to pre-populate your ZCR form. It’s very straightforward. For example

<!-- This is the destination page from the first short form -->

<!-- Extract a single POST variable called name and create a TXP variable of the same name -->
<txp:adi_gps name="nombre" quiet="1" />
…
<!-- use as tag-in-tag to pre-populate a ZCR form field -->
<txp:zem_contact_text name="applicant_name" label="Your Name" default='<txp:variable name="nombre" />' />
…
<!-- alternatively, display results as plain text and pass it on to the ZCR form invisibly -->

<p>Hello <txp:variable name="nombre" />,<p>
<txp:zem_contact_secret name="applicant_name" label="Your Name" value='<txp:variable name="nombre" />' />

or something like that.


TXP Builders – finely-crafted code, design and txp

Online

#14 2016-10-16 20:28:15

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

jakob wrote #302249:

No, on the page that the short form points to, e.g. in your case the ZCR page.

It works like this: when you fill out an HTML form it sends the results to the destination (action) page either as GET parameters in the URL (e.g.?nombre=admi&email=admi@admi.com) or as POST variables (not visible in the URL) depending on the method you set. POST is the most typical method with forms.

You use adi_gps / rah_gps on the page template where you have your ZCR form to read out the value (e.g. the name or email etc.) passed to that page and store it in a txp variable, which you can then use to pre-populate your ZCR form. It’s very straightforward. For example

<!-- This is the destination page from the first short form -->...

or something like that.

Thank you very much. I will try the option.

Offline

#15 2016-10-17 18:36:30

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Quick quote with ZRC with transfering to more detailed form

jakob wrote #302249:

No, on the page that the short form points to, e.g. in your case the ZCR page.

It works like this: when you fill out an HTML form it sends the results to the destination (action) page either as GET parameters in the URL (e.g.?nombre=admi&email=admi@admi.com) or as POST variables (not visible in the URL) depending on the method you set. POST is the most typical method with forms.

You use adi_gps / rah_gps on the page template where you have your ZCR form to read out the value (e.g. the name or email etc.) passed to that page and store it in a txp variable, which you can then use to pre-populate your ZCR form. It’s very straightforward. For example

<!-- This is the destination page from the first short form -->...

or something like that.

Hey! It works. It shows the variables on the page with ZCR! But… zem inputs do not have values, wonder what is wrong with ZCR? I put adi_gps variable into input placeholder, it displays a name, but does not display in on the message. So now have to see to ZCR value issue.

This one

<txp:zem_contact_secret name="applicant_name" label="Your Name" default='<txp:variable name="nombre" />' />

does not work.

Offline

Board footer

Powered by FluxBB