Skip Navigation

[Gelöst] Multi Step PPC landing page using CRED for lead capture.

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
How to create a lead capture form that first captures the email before the rest of the content is submitted?

Solution:
I would have the visitors create just a single post.

You have a CRED form to publish an initial post and this form contains only a field for the email.

The user enters their email address and submits the form.

On completion you redirect to a CRED Edit form which edits the post you just created, and which includes the other fields you want the users to complete (and displays the collected email address without being able to edit it).

When this form is submitted you just have all the info in a single post.

Details are described below.

This support ticket is created vor 6 Jahren, 9 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Dieses Thema enthält 9 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von stuart vor 6 Jahren, 9 Monaten.

Assistiert von: Nigel.

Author
Artikel
#617279

I am trying to create a PPC landing page using CRED.

The workflow I would like to achieve:

1). User submits an email address on the landing page - this is saved (for follow-up if they don't complete the next step).
2). They are taken to a new form which captures the business data. (shows the email entered, but can't edit it).
3). They submit - get a thank you message and are sent an email with confirmation.

Why: I want to capture the email address 1st in case they don't complete the rest of the form, and don't want to present them with a large form (6 - 8 fields) on the initial landing page.

--- What I was thinking
1). CRED Form with just email field - this redirects to the new CRED form on submission - saves the email address in the Parent CPT (Parent CPT called: Email Capture).

2). CRED Form with all the other fields displayed and saves as CPT (Child CPT: Lead Capture) and displayed the email address entered in the first form for "reference".

---- What I don't know.....

how to create the relationship between the two once the first CRED form is submitted. (I have set the Parent/Child Types relationship) - I have read this (https://toolset.com/documentation/user-guides/cred-forms-for-child-content/) and cant figure out if its possible.

Thanks in advance.

#617369

Nigel
Supporter

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: Europe/London (GMT+00:00)

Hi Stuart

You may be overcomplicating this with post relationships.

I would have the visitors create just a single post.

You have a CRED form to publish an initial post and this form contains only a field for the email.

The user enters their email address and submits the form.

On completion you redirect to a CRED Edit form which edits the post you just created, and which includes the other fields you want the users to complete (and displays the collected email address without being able to edit it).

When this form is submitted you just have all the info in a single post.

There are a couple of gotchas with this method, so let me know which route you prefer and I'll help you get that set up.

#617642
accept-terms.gif

Hey Nigel - Managed to find a solution, and yes ... I was over complicating it (I've not used CRED for a while).

Using this method.
https://toolset.com/forums/topic/multi-page-cred-form-or-save-button-for-long-form/#post-298832

I am having trouble saving a Generic field value to the database on the "accept terms" checkbox - unsure if this should be a separate ticket or not so ill post here and it can be moved.

On my CRED form I have a checkbox for accepting terms - generic field - doesn't select the box on the individual CPT once submitted.

Cred Form: 197

[cred_generic_field field='accept-terms' type='checkbox' class='' urlparam='']
{
"required":1,
"validate_format":0,
"checked":0,
"default":"0",
"persist":1,
"label":"Review Terms"
}
[/cred_generic_field]

[cred_show_group if="($(accept-terms) eq '1' )" mode='fade-slide']
You agree to the Terms
[/cred_show_group]

Image of Custom field Id like to populate - attached

Function.php

add_action('cred_save_data', 'save_terms_true',10,2);
function save_terms_true($post_id, $form_data){
if ($form_data['id']==197){
if (isset($_POST['accept-terms'])){
update_post_meta($post_id, 'wpcf-accept-terms', $_POST['accept-terms']);}}}

Cant get it to save!

#617644
terms.jpg

Disregard - I managed to find the solution.

I had checkboxes - rather than a check box. and i didn't need any of the functions.php stuff (delete it)

(changed field name to 'yes' whilst testing in case anyone is looking for a solution)
(include wpcf- on all fields in the generic field)

[cred_generic_field field='wpcf-yes' type='checkbox' class='' urlparam='']
{
"required":1,
"persist":1,
"validate_format":0,
"checked":0,
"default":"1",
"label":"terms"
}
[/cred_generic_field]

[cred_show_group if="($(wpcf-yes) eq '1' )" mode='fade-slide']
You agree to the Terms
[/cred_show_group]

- the field options in case anyone copies (or I come back to this solution) attached.

#617660
part2.jpg
part1.jpg

Oh Nigel - I so thought I had this nailed...

With my setup, I can submit the 1st cred form, it redirects and opens the 2nd form - Awesome.

However - how do I have it open in the same page or a certain part of another page - rather than the whole screen
- no idea how to get it so the second form doesn't consume the whole screen - any help would be awesome.

Functions for reference is this:

/* CRED Multipart form test */
add_filter('cred_success_redirect', 'step2_redirect_func',10,3);
function step2_redirect_func($url, $post_id, $form_data)
{
if ($form_data['id']==196)
{
$arr = array('cred-edit-form'=>197); //the step 2 CRED form post ID
$url = add_query_arg($arr, $url);
}
return $url;
}

#617948

Nigel
Supporter

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: Europe/London (GMT+00:00)

Hi Stuart

You are racing ahead of me.

A CRED edit form must be placed inside an unassigned Content Template (if your are not using Layouts) or a Template Layout (if you are using Layouts). https://toolset.com/documentation/user-guides/displaying-cred-editing-forms/

The template will occupy the whole of the content area of the page, but can contain content other than the CRED edit form, which can be just part of the template.

From your code sample in the last update it looks like you are using the old method. Then the url parameter is cred-edit-form, but if you adopt the current method, the url parameter is for the Content Template or Layout which you would need to update accordingly.

#618509

Hi Nigel - thanks for getting back to me (day off yesterday so picking this up again).

Ok, so after a bit of playing around I think I understand when you save the 'old method' - this is the URL parameter "cred-edit-form" which by default opens the form in edit mode.

With the 'new' method I have to explicitly assign the edit form to a Layout using the shortcode, or content template - cool.

(and in my functions.php call the slug, however, it appears you can actually use whatever in here as long as its not 'cred-edit-form' e.g : $arr = array('cred-whatever'=>197); //the step 2 CRED form post ID )

This means I can now style the Step Two form and page to be what I need - thanks

Now 🙂

... what Id like to do is be able to set a URL parameter on the Step Two page from a field option in Step One.

E.g if its a drop down field with: "Option One" and "Option Two"
When they select "Option One" - the URL will look like something like this "/opt=Option%20One

I will use this URL parameter in a View on this page to show a specific set of data (logos related to their business)

Is this possible? I have seen a number of CRED fields with urlparam='' - however, I have not managed to get anything passed through.

Thanks, Nigel.

#618520

🙂 OK, so I just needed to go to lunch and come back to answer myself on this one.

- because I am editing a form where the data is already saved on the CPT - I can use Types to evaluate the value and run the view - cool 🙂

The only thing I would like to know (and I have tried to understand from the docos) is what the > urlparam='' < is used for, or how I may use it in a project.

"urlparam. Optional. A URL parameter to set default value. For example, a URL with the additional parameter ?some_param=some_value will set the some_value value to some_param."

[cred_field field='first-name' post='lead' value='' urlparam='' class='form-control' output='bootstrap']

#618633

Nigel
Supporter

Sprachen: Englisch (English ) Spanisch (Español )

Zeitzone: Europe/London (GMT+00:00)

Hi Stuart

With the cred_field shortcode you can have a preset value for that field. You can enter the default value directly in the form using the value parameter, or you can set the default value using a URL parameter which you specify with the urlparam attribute.

Note that this is a default value. On an edit form where the field has already been set I wouldn't expect this default value to be used because there is an existing value, although I haven't tested that.

Sorry it is taking a while to get back to you, the queue has been really busy and we are getting through tickets as fast as we can.

#619231

thanks Nigel. support excellent as ever!