Forums

Transfer Data From Form to Page

LikeStuff 26 Aug, 2013
Is it possible to have an amount transferred from a form that I created to another page?

I set-up an application form for users to fill out and on the form I indicated how much they need to pay. After they submit the form it will take them to an "information" page that tells them how to pay; eg: Paypal, cheque, etc...

Is it possible to somehow get the amount from the application form transferred over to the "information" page?

Thank you in advance!!
GreyHead 27 Aug, 2013
Hi likestuff,

You can use a Thank You page to do this - that can include form data. Or you can create a custom page using a Custom Code action that can also include PHP.

Or you can use another form and pass the data with the Data to Session + Session to Data actions.

Bob
LikeStuff 27 Aug, 2013
Thanks Greyhead.

Are there any instructions anywhere on how to do any of these as I have no clue where to start?

Thank you!!!!!
GreyHead 02 Sep, 2013
Hi likestuff,

I'm not too clear what data you have or what you need to do with it.

If you have amount in $form->data['amount'] then {amount} will show the value in a Thank You page.

Bob
LikeStuff 02 Sep, 2013
OK let me start overπŸ™‚

I'm probably confusing you because I know what I want but don't know how to get it to work or what to ask for, so let me tell you what I have and you can tell me how to get it to work.

I created a camp form and on the form I indicated what the cost of the camp is.

After the user submits the form they will then be taken to a page (payment page), with the options of how they can pay. The page is a regular Joomla page.

What I would like is to somehow get the cost that I entered on the camp form transferred over to the payment page. This way I don't have to enter the cost in two places or won't forget to add it on the payment page.

Thank you very much in advance.
GreyHead 02 Sep, 2013
Hi likestuff,

You can insert a ChronoForms in the payment page using the plug-in and transfer the data using the Data to Session and Session to Data actions. (Personally I'd probably make the page a ChronoForm so that I don't have to mess with the plug-in).

You could also use any other module or plug-in on the page that can use PHP (like Jumi or DirectPHP) and pass the info in the Joomla! User session.

Or you could use the ChronoForms ReDirect URL and ReDirect User actions, pass the data in the URL when you redirect to the page and then use Javascript to read it and insert it into the page HTML.

Bob
LikeStuff 02 Sep, 2013

You can insert a ChronoForms in the payment page using the plug-in and transfer the data using the Data to Session and Session to Data actions. (Personally I'd probably make the page a ChronoForm so that I don't have to mess with the plug-in).



I'm going to try the above option. When you say...

Personally I'd probably make the page a ChronoForm so that I don't have to mess with the plug-in



Are you referring to the payment page?

Thanks!!
GreyHead 03 Sep, 2013
Hi Likestuff,

Are you referring to the payment page?

Yes.

Bob
LikeStuff 03 Sep, 2013
Really sorry to bother but are there any kind of instructions on how to do this?

For example, do I need a database for this? How should I add the price on the registration camp form so that it gets transferred to the payment form and what do I add on the payment form so that the payment amount show on that form?

I did a forum search but I'm still unclear on how to get going with this.😟 😟
GreyHead 03 Sep, 2013
Hi Likestuff,

What is actually on the Payment page? Presumably some way of connecting to a payment gateway (or gateways).

You can pass data from one form to another in two main ways:

a) You save it to the user session on the first page and re-load it from the session in the second page. The ChronoForms Data to Session and Session to Data actions do that (as does the Multi-Page action). You can also so this using PHP if you prefer.

b) You pass the data in the URL used to call the second page. The ChronoForms Redirect User and ReDirect URL will do this. You need some code on the second page to get the data from the URL and do something with it. This can be either PHP or JavaScript depending on the application.

c) A variant (b) on this is to use a form as the first page - if you set the method to 'get' you can pass multiple variables (as you can with the ReDirect URL); or you can use the 'post' method - that means that you need to use PHP to read them but they aren't user visible.

Bob
LikeStuff 03 Sep, 2013
Thank you GreyHead,

I was able to transfer data from the payment form to the thank you form when I use an element field.

Is it possible to transfer content that I put in a Custom element ? For example I have text that says something like this:

The cost of the camp is $230 (plus tax).

Is there a way to transfer just the "$230 (plus tax)" ? Is there a way to transfer text that I add on the form?

Thank you!!
GreyHead 04 Sep, 2013
Hi LikeStuff,

Yes but you'd have to add it to a form variable first:
<?php
$form->data['amount_text'] = '$230 (plus tax)';
?>

Or you can transfer just the 230 and add the wrapping text on the second page.

Bob
LikeStuff 04 Sep, 2013
I add a hidden fee and add the amount in the hidden field then add the element name on the thank you form.

Somehow I don't think that is what you instructed me to do as I wold have to enter the amount twice, once on the form and once in the hidden field.

I was hoping to enter it only once, unless that's the only way to do it?

Thank you!!
LikeStuff 04 Sep, 2013
I tried it a different way that I thought would be better but I'm a bit stuck.

I add this in the custom element:
$form->data['camp_fee'] = '$230 (plus tax)';


Then in the "Event", "Show Thanks Message" I add this:
<?php echo $form->data['camp_fee']; ?>


After I submit the form, this is what I see on the thank you page:
data['camp_fee']; ?>


What am I missing please?
GreyHead 05 Sep, 2013
Hi LikeStuff,

You can't use PHP in a ChronoForms Thank You page action but {camp_fee} should work if that is where you are using the code.

Bob
LikeStuff 05 Sep, 2013
I guess my lack of coding is making this confusing for me...

I assume what I have in the custom element, as per below, is fine - correct? Or is it missing something?
$form->data['camp_fee'] = '$230 (plus tax)';


What should I put in the "Show Thanks Message" to display the data after the form is submitted. I add the PHP code that you say should be there and now I add the below but it doesn't show the text.
{camp_fee}


Sorry but I am really confused with the steps, and what is required where, but I would like to get this to work 😟

Thanks!!
GreyHead 05 Sep, 2013
Hi LikeStuff,

Hmmm maybe - I've lost track of where you are using these various bits of code :-(

At the very least it will need to be inside <?php ?> tags.

Bob
LikeStuff 05 Sep, 2013
Ummmm I described where I'm putting the codes :?

I add this in a custom element:
$form->data['camp_fee'] = '$230 (plus tax)';


Then in the "Event > Show Thanks Message" I add this:
<?php echo $form->data['camp_fee']; ?>


But you said:

You can't use PHP in a ChronoForms Thank You page action...



Thanks!!
GreyHead 06 Sep, 2013
Hi LikeStuff,

If you are setting the value
$form->data['camp_fee'] = '$230 (plus tax)';
in a Custom Element element then I assume that it must be in the Preview box and therefore linked to the On Load action of the form.

That's OK but it won't then be passed to the On Submit event - where the Thanks Page is unless you arrange for that to happen. The simplest way would be to add a hidden input called 'camp_fee' to the Preview Box.

On the other hand, when you said 'custom element' you might also have meant a Custom Code action in the On Submit event - in which case it ought to work OK.

Bob
This topic is locked and no more replies can be posted.