Forums

Using Profile Plugin to populate a form

orubin 05 Jul, 2009
OK, maybe I am just too much of a novice to do this on my own, but I too have been trying to do something that should be simple I think, and it is not working. Maybe I am missing a step?

I have a FORM (call it FORM 1) that a user fills in with Name and email and a few other choices. After some other steps IN THE SAME SESSION, the user will be taken to a second form (FORM 2) which appears for the user to enter additional additional information. Both forms will be emailed (which works fine) to the user and us.

In FORM 2, I want to repopulate the name and email, and maybe one other piece of data data from FORM 1 to appear in Form 2 so they do not have to enter it again. The user may or may not be logged in, and I do not care. And if they log out or leave before they get to FORM 2, they will have to fill out FORM 1 again, so the data does not have to survive very long actually.

So following tutorial #5 (http://www.chronoengine.com/tutorials/52-5-saving-data-to-the-database.html), I created a DB Table as instructed, and attached it to my FORM 1 to save the data elements I wanted. This works just fine, and I have successfully seen the data in a table using the forms management tools. But now I want to use that data in FORM 2, and it s not working. This is where I need help. Here is what I have done so far after that:

1) In FORM 1, I have enabled the Profile plug-in by checking the little box.
Question: What value do I put in the small field next to the plugin where it has the + and - value setters? I set it to 0 just to have a value. Does it even need one?
2). In FORM 2, I have also enabled the Profile plug-in and set its value also to 0.
Question: Is the value necessary here? I tried them both blank too, no difference.
3). In Form 2, I selected Profile Management and then selected my table from the drop down menu.
Question: I can only select one field name here. What if I want to use more? What is this field select for? Which field do I select? Does it matter? (I selected the first cf_id since it did not seem to matter.)
Question: Do I also have to do this in FORM 1? Doing so made no difference.
4). The text fields I want are called text_28 (name) and text_27 (email). They are in the table from FORM 1 and populated.
I added this code to the HTML of FORM 2:
Name: {text_28} <br />
Email: {text_27}

I have had two results. One time and one time only, the fields came back blank when FORM 2 was displayed. Now, they simple show up EXACTLY as typed above, showing the text "Name: {text_28}" etc right in the form. No substitution is made for the data in the table.
Question: What have I left out or set wrong? I cannot make this work.

A few more questions:
1). Will this method of saving form data to a table cause problems if more than one user is using the same form at the same time? Or is the table somehow session related, and I do not have to worry about collisions? Users may or may not be logged in.

2) The table populates with many entries, the more I test, the more entries I get. How does FORM 2 know which entry to use? It seems as if I can end up with another's data here. How do I make sure the proper data moves forward?

3). If I made an error in the table (say I want more fields now), how do I edit or delete it? This does not seem to be possible from the forms management area. And trying to replace it causes an error. How do I do this?

I suspect this is easier than I think, so perhaps this is just above my skill level showing through. I have experimented with many settings, but I am just shooting in the dark because I do not know what the settings really mean.

Any help would be appreciated. Perhaps it is all there, and I just do not understand settings?

Thanks in advance.
-Owen Rubin-
GreyHead 06 Jul, 2009
Hi Owen,

Along post and a lot of questions so apologies in advance if I miss something.

First off - are these registered users? I think not, but I'm not completely clear.

If they aren't then you probably don't need the Profile Plugin. That's really designed to capture data that is saved in the database either for display or re-editing.

For your case the Multi-step Form plugin should do the trick. I posted a little tutorial (I think in the Plugins section here) that tells you how to re-use data from an earlier step.

For the sepecific questions (most of these are useful but irrelevant if you go the multi-step route):

Question: What value do I put in the small field next to the plugin where it has the + and - value setters? I set it to 0 just to have a value. Does it even need one?

This just let's you set the order in which plugins are run if you are using more than one with the same form. You can ignore it here.

Question: Is the value necessary here? I tried them both blank too, no difference.

See above.

Question: I can only select one field name here. What if I want to use more? What is this field select for? Which field do I select? Does it matter? (I selected the first cf_id since it did not seem to matter.)

The field you select here is the record identifier that you are going to use to access a specific record from the table.

Question: Do I also have to do this in FORM 1? Doing so made no difference.

You would only need it in Step 2 to reaccess the data saved from Step 1.

Question: What have I left out or set wrong? I cannot make this work.

Not sure why this wasn't working, possibly because the cf_id wasn't being added to the url for Form 2 so it didn't know which record to load.

1). Will this method of saving form data to a table cause problems if more than one user is using the same form at the same time? Or is the table somehow session related, and I do not have to worry about collisions? Users may or may not be logged in.

No, the cf_id will be unique.

2) The table populates with many entries, the more I test, the more entries I get. How does FORM 2 know which entry to use? It seems as if I can end up with another's data here. How do I make sure the proper data moves forward?

From the cf_id

3). If I made an error in the table (say I want more fields now), how do I edit or delete it? This does not seem to be possible from the forms management area. And trying to replace it causes an error. How do I do this?

No, you have to use PHPMyAdmin (or the Joomla EasySQL extension) to amend the tables; or you can delete them and addnew ones from ChronoForms.

Bob
orubin 07 Jul, 2009
Thanks for the answers, but I am still stuck.

The multi-form idea will not work because of a few steps BETWEEN the two forms.

It goes like this: Fill in Form One (name, email, select from pop-up, agree to terms, fill in captcha) and SUBMIT.
On Sumbit, I email that info to us, and redirect them to a page with price info and a PayPal button, where they can press PAYPAL button and pay. That takes them to a Paypal page, they pay there, and submit.
The Paypal page redirects to Form 2 on our site. Ideally, I would love it if the form could fill in with all the data they put in Paypal (but of course, no access to that), but I would be happy if it just repopulated the form with name, email, item picked (could just be display text fields)from FORM 1, and then display three or four more pieces of info for them to optionally fill out (the form is created.) They can either submit, or skip this step, but I want it there just the same.

I cannot get FORM 2 to fill in from the date of FORM 1. The data from FORM 1 is in the database in the table designated, and of course, each pass through the form creates a new record (which I wish would also not happen), but how do I make FORM 2 get this data out of the table?

Again, multiple users may be using the form, and they are typically not logged in.

So, I want a single record saved ONLY long enough to populate the second form. And I want to be sure other users do not step on the data of each other in that interim step.

Does that make more sense?

Thanks in advance.
-Owen-
orubin 07 Jul, 2009

Hi Owen,
...you have to use PHPMyAdmin (or the Joomla EasySQL extension) to amend the tables; or you can delete them and addnew ones from ChronoForms.
Bob



I forgot to ask. How do I delete them in ChronoForms? I do not see a way to do that, and EasySQL does not have a Delete function either.
-Owen-
GreyHead 08 Jul, 2009
Hi Owen,

You can enter DROP TABLE IF EXISTS `jos_xxx`; in the EasySQL and it will be executed - be careful!!!!

Bob
orubin 08 Jul, 2009

Hi Owen,

You can enter DROP TABLE IF EXISTS `jos_xxx`; in the EasySQL and it will be executed - be careful!!!!

Bob



Thanks Bob. Careful I will be. Always worried about screwing up the database (Which I backup daily!)

Did you get a chance to see the previous post of mine as well? I do not think multi-form will work (and actually did not see a Multi-form plugin anywhere either) because of intermediate steps. Form 2 will be called by a PayPal redirect link, so a mother form will not be present to manage (I believe.)

Cheers,
-Owen-
GreyHead 11 Jul, 2009
Hi Owen,

Going back to your earlier post.

If your users aren't logged in then I'd create a unique transaction ID and use this to track them. It can be a Unique random string generated after the form is submitted. Add this to the database record and define the field as a primary key. Add the same ID to the PayPal URL and when the data is returned you can pick up the record from the table and continue processing.

You could do this with a Multi-step form using the 'Steps navigation' option to get PayPal to return you to the next step. I'm not sure that you need to though.

You can also get a lot more information returned from PayPal by using IPN - but that may be a bit too complex for this ost.

Bob
orubin 17 Jul, 2009

Hi Owen,

Going back to your earlier post.

If your users aren't logged in then I'd create a unique transaction ID and use this to track them. It can be a Unique random string generated after the form is submitted. Add this to the database record and define the field as a primary key. Add the same ID to the PayPal URL and when the data is returned you can pick up the record from the table and continue processing.

You could do this with a Multi-step form using the 'Steps navigation' option to get PayPal to return you to the next step. I'm not sure that you need to though.

Bob



Thanks Bob. Wish I knew what that meant. As I said, I have no PHP programming experience, but I have programmed so I should be able to figure it out. But can you be more specific? What is a transaction ID? Is there some sample code that shows how this is done? So far, I am not making this work.

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