Forums

Chronoforms v4 Multi Page Form

amorpeth 28 May, 2011
Hey,

I have been searching for a way to create a multi page form in v4 but cant find anything. Hoping someone could give me a step by step or point me to some documentation. I am very new to Chronoforms so as much detail as possible would be great๐Ÿ™‚

I have created my first page and everything works as expected. I would now like to add another 3 pages and have the data delivered as 1 email.

Thanks in advance!!

Andrew
GreyHead 28 May, 2011
Hi Andrew,

I haven't worked it out fully but I suspect that all the pieces are there in CFv4 to build a multi-page form.

On each step you need to add a Session Data | Data to Session action in the On Submit event. Then on the last step add a Session Data | Data from Session to get it all back to use in the email.

Also each step needs a Redirect User action to go to the next form.

Bob
gnipp 02 Jun, 2011
Hi Bob,

may I kindly ask you to precise your previous answer, please?

I'm about to make an order form in J1.6 and need to share it into several forms to avoid to overload the user with a long annoying form. So I'll do it as follows:
1. provide personal data (user account creation)
2. fill in data for desired product specification
3. payment (different options, like direct debit or paypal)
4. confirmation (terms and conditions, captcha)

How do I put data from several forms into one db table?
How could previously provided information be reused in a following form?
How could a conditional jump be realized (pay with _paypal -> paypal_form, direct debit -> debit_form)?

Thank you very much for answering.

Best regards,
Gerald
GreyHead 02 Jun, 2011
Hi Gerald,

I haven't done this yet so you are out exploring.

I think that the answer is like this (I'd use very simple forms to test the flow first):
[list=a]
  • Set up the four forms and check that they work at the basic level

  • Add a Data to Session action to Form 1

  • Add a ReDirect URL Action to Form 1 and have it point to form 2

  • Add a Data from Session and a Custom Code to the On Load action of Form 2 and use the Custom Code to check that there is some session data (if not then redirect to form 1)

  • Repeat with Forms 3 & 4

  • Add a Data from Session to the On Submit action of Form 4 and then add the appropriate code to email, save, etc.
  • [/list:o]
    That leaves us with the conditional code for the payment. I think that may need a new 'Fork in the Flow' action. I'll think about that some more. There's probably enough here to keep you going for the moment.

    Bob
    gnipp 08 Jun, 2011
    Hello,

    this is a really frustrating job to find solutions by try and error.
    Personally, I would highly appreciate a documentation for Chronoforms as available for all other Joomla form plugins. It is really annoying to spend days and days searching solutions in the forum and testing them one by one. I'm really considering to abandon Chronoforms for another product.

    There was no information that Chronoforms may be a usefull tool for coding experts only - not for "ordinary" users, who are looking for out-of-the-box-click-and-happy solutions. And the only information source, the forum, is unstructured since several different versions are mixed. Due to the absence of keywords, the user is obliged to find relevant information between several versions and if found, the core team is conflicted: http://www.chronoengine.com/forums.html?cont=posts&f=26&t=22069&start=0&hilit=omit (I know that this one is about a release candidate!)

    I'm still unsuccessfully trying to do a simple multi page form - nothing extraordinary. But I'm struggling with basic tasks like calling one form from another. And this becomes endless due to the leak of a manual.

    This should not be understood as criticism on the tough programming job done from the team. But it shows once more that even the best tool is worth nothing without a documentation.

    Best regards,
    Gerald Nipp
    GreyHead 08 Jun, 2011
    Hi Gerald,

    Personally, I would highly appreciate a documentation for Chronoforms



    Me too, are you offering?

    Bob
    gnipp 09 Jun, 2011
    Well, of course, I would. It's a pity to have such a tool without docu.

    But first of all, I'd need to understand how it works. It's like the question if the hen was first or the egg?

    What would be the prefered format?
    Is there anything available yet? (Layout, outlining, ...)

    I'll do it, if you will provide the necessary information. And it wont become a book, of course, but just a documentation of which function is doing what and which parameter may be used where and so on. This might be filled up with examples like your tutorials and with a snippet collection.
    Since I'll go on vacation next week, I'd need to have the stuff before. I may write down, what I know and prepare the open questions for you.

    I may create it in English and German but I prefer to do the English one first.

    Would that be possible?
    Do I need CVS connection? (I'll be offline next week)

    Regards,
    Gerald Nipp
    gnipp 09 Jun, 2011
    Here is a first structure for the doc.
    Is that ok? What needs to be added?

    Beside the Freemind original, you'll find an OpenOffice and an xhtml version in the 7zip file.

    [attachment=1]CFV4.7z[/attachment]
    GreyHead 09 Jun, 2011
    Hi Gerald,

    Thank you very much, I have to say that I was not expecting you to say Yes. But Max and I will be delighted with any contribution that you can make.

    I haven't checked every detail but the mind-map looks a pretty full description of the actions and event. I'm not sure that it's the most useful documentation structure for most users. My sense is that 95%+ of users come to ChronoForms with a specific task in mind and what they are looking for is 'How do I do X?'. The need for a reference comes later and often not at all.

    Have you looked at The ChronoForms Book for CFv3? That was structured as a series of 'recipes' (at the publisher's specification) and seems to me the most useful approach.

    I think that a good place to start is to take a ChronoForms task - like creating a multi-page form - and document how to do that.

    There are a few documents in the Downloads area that Max has created for CFv4 that are a beginning. There are also all of the book recipes and a fairly long list of tutorials on my site that could be used as starting points. Unfortunately there are sufficient changes in CFv4 that it's not simple a find and replace task to update them.

    My problem is that the forum traffic has increased considerably since the release of CFv4 and I am spending more time than I have availabe here which leaves no time to re-write the docs.

    Bob
    gnipp 10 Jun, 2011
    Hi Bob,

    honestly, I'd rather prefer a more formal reference with additional cooking recipes, as shown in the brain map above. The advantage is that you may avoid blowing it all up with redundancy by referencing to the concerned description.

    Example: "For a multi page format, you'll need to create [...] adding at least a textbox (page xx), a submit button (page yy) and then adding a "Data to session" action (page zz) in the On Submit section (page aa) followed by [...].
    (I hope you understood what I meant)

    That keeps the documentation usable as a dictionary on one hand and offering the famous recipe-approach on the other hand. Beginners may choose their prefered approach and advanced users may find information quickly. By the way, professional cooking books are made up the same way. Your opinion?

    Either way, I need to have the stuff before my departure on Sunday. (As I travel on my own by train, I'll have some time.) So please provide a download for me asap.

    Regrads,
    Gerald
    GreyHead 10 Jun, 2011
    Hi Gerald,

    I understand.

    I'm afraid that there is no other 'stuff' for you to have other than the code in the component itself.

    I can let you have a copy of the 3.1 book pdf if that would be helpful.

    Bob
    gnipp 20 Jun, 2011
    Salut Bob,

    I'm back from holiday and may start now with a delay however.
    May you send me a link to the PDF mentioned above?

    Then I will refine the content and come back for further coordination.
    What do you think about my proposal. Would you agree to do it the way I described previously or would you rather insist to have it the way the book was made?

    Thank you in advance,

    regards,
    Gerald
    gnipp 27 Jun, 2011
    Hi Bob,

    what's up? I'd like to start but I'm still awaiting your information.
    Is there anything wrong?

    Thanks for answering.

    Gerald
    GreyHead 27 Jun, 2011
    Hi Gerald,

    Sorry, I was away last when you posted and missed the post when I came back.

    I'll email you the PDF.

    Please write in whatever way is easiest for you.

    Bob
    gnipp 27 Jun, 2011
    Hi Bob,

    alright, so I'll come back later with the first drafts for correction and enhancements.
    Of course, as mentioned below, I'll have to leave some explanations incomplete since I simply don't know them yet. However the PDF will help to find out most of it, I guess.

    See you.

    Gerald
    darren 19 Aug, 2011
    Hi Bob, Gerald,

    I was wondering if anything more on this "how to multi page form" ?
    I am trying to do one (3 part) now, and searching the forums, I am not finding anything really helpful.. (am I missing a post that spells it out?)
    Also has anything been done to have this option built into v4 like it is in 3?
    (having the option to make mother and child forms?)
    Thanks in advance from me
    (and that's a thanks from my boss breathing over my shoulder asking if its done yet?)
    ;)

    Darren
    GreyHead 19 Aug, 2011
    Hi Darren,

    There isn't a tutorial or a multi-page action :-(

    I've managed to get it working OK by using the Data to Session action on the first form step; then the Session to Data action in the On Submit event on the second form step. If you need the data in the form then you can also put a Session to Data action in the On Load event.

    Bob
    olaeblue 07 Sep, 2011
    Hi there, any progress on the documentation?

    I am struggling to work out what a number of the actions actually do. The names seem tantilisingly close to what I need but I can't get my head round making them work. I could post a load of questions but I see GreyHead is already working overtime :-) and think with even some 'light' documentation I could work it out.

    Happy to write up what I learn, to improve the documentation, if I can get a start.

    Thanks
    GreyHead 16 Sep, 2011
    Hi olaeblue,

    Not much progress with documentation I'm afraid :-(

    I have a fair idea what most of the actions do now so feel free to ask.

    Bob
    jhdesign 21 Sep, 2011
    How do you load the variable on the second form? (2nd form has Session > Data in it).
    GreyHead 21 Sep, 2011
    Hi jhdesign,

    It should be automatic provided that the input names match and 'Republish form data' is set to Yes (the default) in the Show HTML action.

    The 'Session to Data' action needs to be before the 'Show HTML' action too.

    Bob
    jhdesign 21 Sep, 2011
    Bob,

    I've done that. I have SELECT for "country" on Form1 and on Form2 I have it as a hidden field.

    Is there also a way to echo out that field value? Id like to use it on Form2's H1.

    Jacob

    PS on Form1 I have these actions:

    OnLoad - load js/css/show html
    onSubmit - Data to Session, Redirect

    Am I missing anything critical there?
    GreyHead 21 Sep, 2011
    Hi jhdesign,

    I don't see anything critical missing.

    You can display a value with <?php echo $form->data{'some_input_name']; ?>

    Bob
    jhdesign 21 Sep, 2011
    Still no go. Not showing "country" on second form (after selecting in on first form).

    Any other ideas?
    GreyHead 21 Sep, 2011
    Hi Jhdesign,

    Missed this, please make sure that the session key is the same for both Session actions - it defaults to the form name and that won't be the same.

    Bob
    jhdesign 21 Sep, 2011
    Bob, that did it. Thank you. I'll update the other thread.
    eglescout 27 Sep, 2011
    Did anything happen with this? I'm interested in this because I have several forms that use the same components. I sometimes have to update/change the common components; it would be really nice to change one form instead of many.

    Thanks!
    GreyHead 27 Sep, 2011
    Hi eglescout,

    Not sure I understand what the "this" is that you are asking about?

    Bob
    jmarian1 15 Feb, 2012
    Hi Bob,

    I've come to this problem also. Both form1 and form2 have the same session key but in form2 I can see only the debugger result and not the information that I want. I put the custom code to the onLoad event and still doesn't show anything but the debugger data only. Please help. Thanks.

    Form1 have the following setup:
    [attachment=1]Screen Shot 2012-02-15 at 11.50.41 AM.png[/attachment]

    Form2 setup below:[attachment=0]Screen Shot 2012-02-15 at 11.52.14 AM.png[/attachment]
    wibadd 16 Feb, 2012
    I'm experiencing the same issue. I restored the forms from this post and tweaked it a bit to try to test a display page and the Back button. I can see that the data is in the session using the debugger, but I haven't yet figured out how to display it. Also, how can I retain the data from the display page when selecting Back and returning to the original form? Attached is the backup of the forms I've been experimenting with.

    I also installed V4 RC3.11, but haven't yet figured out how the Multi Page event works. It states "This action should be added to the TOP of every event used in a different form page so that it can handle all the data transactions between the different pages." Not sure if these means load and submit events or other sub-events such as Session To Data, Show HTML, etc. What exactly does it do?

    Thanks in advance for your help in figuring this out! :wink:

    Chad
    Max_admin 16 Feb, 2012
    Hello,

    I'm attaching a multi page demo form, I hope that it will answer some questions๐Ÿ™‚

    Minimum requirements: Chronoforms V4 RC3.11

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    wibadd 18 Feb, 2012
    I gave this a try, but I'm encountering problems with the CSSV which I have On Submit. Instead of showing the confirmation page (Thank You Message) it stays on the same page and wipes out the values populated by JS. I also tried using the Back buttons on the demo form from the prior post but it returns to the prior page and doesn't display the data.

    Attached is a copy of the form I'm working on. I need to run CSSV to validate and set certain values before I can show the user a confirmation page. I also need to provide a Back button so they can edit the data if needed.

    Thanks in advance for the help with this!

    Chad
    jmarian1 18 Feb, 2012
    My problem is almost the same with wibadd. However, the only difference is, my CSSV works on the first reload after there is an error but like wibadd, my JS and ajax doesn't reload so I am unable to select my second drop down list and populate my textboxes after clicking the submit button. Also, after clicking the submit button, even though there is still error because second drop down button made by AJAX is not working, it goes directly to the thank you message which is not supposed to. How can I make my JS ad AJAX works after reload if there is an error? And how can I not pass to the Thank you message if there is still an error? Please advice. This is frustrating as I cant figure it out myself. Any help is appreciated. Thanks in advance.

    I wonder which one is easier to solve, using the confirmation page which problem is only the CSSV that is not working and AJAX/JS that is not working as well when you click the back button or this multi-page problem stated above? Hope there is a solution to either one of them so I can use it.
    Max_admin 18 Feb, 2012
    Hi Chad,

    3 notes:

    #1- your CSSV code has a parse error, I believe this affects the result, please try to configure your website/PHP to display errors and check that.
    #2- the "Show HTML" action in the "on submit" event should be configured to display page #2, correct ?
    #3- you can add a back button to a submit button element in the field settings, tick the "back button" option.

    Please check that and let me know๐Ÿ™‚

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    wibadd 18 Feb, 2012
    Hi Max,

    #1- I checked the code in an editor and it passed (Netbeans) and it was working before when I used the Confirmation Page event. Unfortunately, I could not get the Confirmation Page event to work correctly to present the data back when the Back button was selected. The CSSV errors were displaying then, so I don't think the issue is with my website/Joomla/PHP configuration.
    #2- The reason I have Show HTML is because I have a button set for the confirmation page (#2), but I shouldn't need it for the Thank You Message from what I understand. I am simply using the Thank You Message event to display the inputted values like your demo form did. Not sure what else you are referring to with this.
    #3- I set this in the page #2 Submit button fom element. The problem is that page #2 won't display and I think it has something to do with the CSSV that runs On Submit.

    It looks like everything that you mentioned has already been configured, but it is still not functioning.

    Chad
    GreyHead 18 Feb, 2012
    Hi Chad,

    Just checking here. As far as I can see this isn't a true multi-page form except that you want to have Confirmation page functionality before passing the results to the payment gateway.

    Bob

    PS The PHP error is on line 14 of the ServerSide validation code - there is an extra ( near the start of the line.
    if (($_POST['level'] != "Silver" && empty($_POST['electricity'])) {
    should be
    if ( $_POST['level'] != "Silver" && empty($_POST['electricity']) ) {


    As an observation, working with ChronoForms it's usually more reliable to use the $form->data array rather than the $_POST array or the Joomla! JRequest methods. It probably makes no difference here but it can cause problem when data is being changed or passed from place to place. The equivalent would be
    if ( $form->data['level'] != "Silver" && empty($form->data['electricity'] ) {
    wibadd 18 Feb, 2012
    Thanks Bob, I noticed the extra ( after I posted. I also noticed that I did not set the values in the Multi Page tab on the Show HMTL event. ๐Ÿ˜ถ

    I updated as you recommended and everything seems to be working except the back button. It still wipes out the form data when it is selected.

    Also, one other strange anomaly is when there is more than one server side validation error. It displays them in order based on the CSSV code, but I noticed that when I correct one and resubmit it the next validation error is not displayed. Only when I resubmit it again does the next error display. Any idea why this is?

    I attached the latest copy of the form for your review.
    GreyHead 18 Feb, 2012
    Hi Chad,

    Great. I have the form working at least as far as the confirmation page Back & Submit (with one caveat). In no particular order:

    1) I've rewritten the ServerSide Validation code with a few changes.
    <?php
    $valid = true;
    if ( $form->data['state_province'] == " " ) {
      $form->validation_errors['state_province'] = "Select the state/province of your company/organization";
      $valid = false;
    }
    if ( $form->data['level'] != "Silver" ) {
      if ( empty($form->data['description']) )  {
        $form->validation_errors['description'] = "Please enter up to a 650 character (including spaces) description of your company/organization";
        $valid = false;
      }
      if ( empty($form->data['electricity']) ) {
        $form->validation_errors['electricity'] = "Please indicate if you want electricity at your sponsorship booth";
        $valid = false;
      }
    }
    if ($form->data['cc_exp_month'] < 01 || $form->data['cc_exp_month'] > 12 ) {
      $form->validation_errors['cc_exp_month'] = "Please enter the 2-digit numeric month (01 to 12) of credit card expiration";
      $valid = false;
    }
    if ($form->data['cc_exp_year'] < 2012 || $form->data['cc_exp_year'] > 2020 ) {
      $form->validation_errors['cc_exp_year'] = "Please enter the 4-digit numeric year (i.e. - 2012) of credit card expiration";
      $valid = false;
    }
    $cc_exp_date = strtotime($form->data['cc_exp_year']."-".$form->data['cc_exp_month']."-28");
    $today = strtotime(date("Y-m-d"));
    if ($cc_exp_date < $today) {
      $form->validation_errors['cc_exp_month'] = "The credit card has expired";
      $valid = false;
    }
    if ($form->data['level'] == "Silver") {
      $form->data['description'] =  "";
      $form->data['electricity'] =  "";
    }
    if ( $valid ) {
      $sponsorship_amount = '';;
      if ($form->data['level'] == "Software") {
          $sponsorship_amount = 2500;
      } elseif ($form->data['level'] == "Gold") {
          $sponsorship_amount = 1000;
      } else {
          $sponsorship_amount = 500;
      }
      $form->data['amount'] =  $sponsorship_amount;
      $form->data['cc_card_xxxx'] = 'XXXX-XXXX-XXXX-'.substr($form->data['cc_number'], -4);
    } 
    return $valid;
    ?>

    [list]
  • I've switched to use $form->data throughout

  • I've added the $valid variable and set this to false when a check fails. This lets us get through them all before returning.

  • I've added a line at the end to compute the XXX value for the credit card (you can't use PHP in the Thank You page so that needs to be pre-calculated).

  • I would move this last block of calculations into a separate Custom Code action to be tidy; here I've used $valid to skip it if not needed.
  • [/list]

    2) I switched both Multi-Page action to set the Session Key to NO (I don't know why but this seems to let the form re-load OK)

    3) I moved the XXXX calculation out of the Thank You page code and replaced it with {cc_card_xxxx} to pick up the value calculated above.

    4) I've taken out the second Show HTML and put back a Confirmation Page action. The action sequence is below.

    I think that is most of it. I've attached a back up of the amended form. I haven't looked at the Payment Gateway code I think that needs to be moved back into the Main On Submit event.

    Bob

    PS The caveat is the Logo upload which currently isnโ€™t re-loaded. This may be a browser security feature. It might be worth thinking about moving this to a secondary form after payment is confirmed.

    Events and Actions:

    On Load event:
    MultiPage (with Session Key => No)
    Dynamic Dropdown
    Load JS
    Show HTML

    On Submit event:
    Multi Page (with Session Key => No)
    Custom Serverside Validation
    On Success:
    empty
    On Fail:
    Event Loop (default settings)
    Confirmation Page
    On Show:
    Show Thanks Message
    On Fail:
    empty
    On Back:
    Event Loop (default settings)
    //// to do ////
    Load Files
    Authorise.net
    On Approved:
    empty
    On Declined:
    Event Loop
    On Error
    Event Loop
    On Hold
    Event Loop
    Image resize
    Submit Article
    . . .

    Note that an Empty action or an action without an Event Loop or other redirector lets the flow drop through to the next action in the parent event.
    Max_admin 18 Feb, 2012
    Hi Bob,

    Thank you for taking care of this issue!๐Ÿ™‚

    @Chad, I'm glad you are progressing!

    Just a note which may be helpful for everybody, back to #2 posted in this post:
    http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=22006&start=30#p267245

    I was going to suggest that you use a "Custom element" after the "Page Break", and paste your "Confirmation page" code there, then have your "submit/back" buttons element, and after correctly configuring your "Show HTML" action in the "on submit" event, I think that would work as expected, I didn't test it of course but I assume it would be ok๐Ÿ™‚

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    wibadd 19 Feb, 2012
    Thank Bob and Max. I took your advice regarding the upload and moved it to a page after the Authorize.net event.

    I noticed that when the session key set to No it does not clear data from the form page. When I select the menu item after I input data, it continues to display what was previously inputted. This is also apparent when a SSV error occurs, the information is corrected and re-submitted. When I select the Back button in this situation it displays the previous uncorrected data and the validation error. Is there any way to correct this?
    Max_admin 19 Feb, 2012
    Hi Chad,

    What were the side effects of leaving the "Session key" set to "Yes" ? please explain so I can test here.

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    wibadd 19 Feb, 2012
    When the Back button was selected it returned to the prior page but none of the data was displayed.
    jmarian1 20 Feb, 2012
    Hi Bob/Max,

    First, thanks for the great tutorial however maybe it is not for me but it helps me a lot. I tried to use Bob's tutorial but I get more error.

    My attached form is almost the same like Bob's tutorial but I only have two issues so far:

    1. When you click the 'back" button after submit, my second double drop down doesn't show my selection initially so it goes back to "Please select district" and when you try to select the first drop down (district), it doesn't search the second drop down anymore. Is there a way to stick my initial selection when you click the "back" button so I don't need to choose again?

    2. Once you click the "submit" button again, it goes direct to the thank you message although there is still some missing information because of the double drop down. How can we fix that?

    Lastly, I know you will ask me why I don't follow Bob's tutorial above. I did actually created one and compare to what I currently have and I get more error which added also wibadd problem that when you click the "back button" the data selected is gone that is why the error shows too. The Multipage either yes or no, still acting the same. So that ends me up to more problem. Dont get me wrong. Bob's tutorial is very helpful and I actually understand a lot on how the multi page and confirmation page works.

    I am hoping that you can help me and maybe helpful also if I attached my form here. The more I stare to my code and figure out what is going on, the more I mess around. Max, I don't know what happened but when I fix the "school id", somehow the JS/AJAX event is not working again when you click the back button. This can be fix if there is a way to stay the second drop down selected when the back button is click or able to select again. Please help. I really need this to work. Thanks in advance.
    wibadd 20 Feb, 2012
    I've encountered a couple of issues so far. My apologies in advanced for the lengthiness of the post. ๐Ÿ˜Ÿ :?

    1) I restored this form to our production environment but only display the menu for registered users. It seems there is an issue with the republish option in the Show HTML event as follows:

    Warning: preg_replace(): Unknown modifier 'p' in /usr/local/pem/vhosts/107732/webspace/httpsdocs/components/com_chronoforms/libraries/includes/data_republish.php on line 173 Warning: preg_replace(): Unknown modifier 'o' in /usr/local/pem/vhosts/107732/webspace/httpsdocs/components/com_chronoforms/libraries/includes/data_republish.php on line 173

    When I switch it to No it no longer displays the error, but then it doesn't republish the form data when Back is selected. It didn't behave this way in my test environment, so I'm not sure what to make of it. Any ideas?


    2) I moved the Authorize.net action into the On Submit but it was behaving strangely after the CSSV and Confirmation Page. Since it kept rendering the A.net debug info above the Confirmation page and also displayed the form below that, I moved it into a separate event after On Submit. I have it working, the only problem is that it is not progressing to the last page which provides the upload. I have the page break above the File Upload element with a Submit Button element below it. All I get is a blank page.

    [attachment=2]Event Order.png[/attachment]

    This leads me to one other question. Bob recommended providing the file upload at the end after payment authorization, but couldn't I just add it to the main form and have a Upload Files event before the CSSV? If the user went back a page and selected again, it would run the Upload Files event again and the file would just be overwritten, right? My thought is that way I don't have to try to get three different pages to function and I can just run the Image Resize event at the end to save them to the folders where I need them. Would that work?


    3) Lastly, I am running the form on SSL because it will be processing payments. The strangest thing is happening - I have the default value of the website text box set to http:// yet the form is displaying https://. What is causing the form to populate a secure URL prefix?

    [attachment=1]Website Prefix Display.png[/attachment]

    Attached is the latest copy of the form. Thanks for your help in resolving these issues!

    Chad
    Max_admin 20 Feb, 2012
    @jmarian, I will try to check the form again and get back to you by email.

    @Chad,

    #1- fixed in the new version, I'm planning to have it published today if all is ok, or you may contact me by email to get it sooner if you like.

    #2- Well, you have both the "Confirmation page" and "Multi page" ? I just can't imagine how this is going to work, you place your actions in the same order you want them to run, so if you want the file uploaded before the payment then place it before the "Authorize.net", it depends on your form's logic.

    #3- I think that Joomla does this, it replaces all the "http://" strings in the output buffer by the https to make sure that any internal links are https, maybe you can remove it from the box and do some post submit processing for this field, check if it exists or not and add it if not, using PHP code of course.

    I will try to download your latest form file and get it to work here in a few hours๐Ÿ™‚

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    wibadd 20 Feb, 2012
    Thanks for the prompt reply, Max.

    #1- I sent an email to you

    #2- This is how Bob had it setup, so I followed the same path. I tried using a custom code event but then the buttons do not work. I also tried a Custom Element and Submit button and that works; however, when I select submit on the confirmation page it displays the form with data again. I really need some help on this one - nothing seems to work quite right. I just need a confirmation page for the user to review their data before I run the A.net event. They need to be able to return the prior page or confirm and run the transaction. What events and ordering do I use to accomplish this?

    #3- Thanks, I'll give the PHP a try.

    #4- Is there anyway to clear the data out of the session? If I set the Session Key to No in the Multi Page event it holds onto the data and never clears the session even if I exit the browser, open a new browser and revisit the page. If I set the Session Key to Yes, then it does not display the data when I Go Back.
    Max_admin 20 Feb, 2012
    Hi Chad,

    Just a quick question, what's the code of your "Back" button which doesn't work when you set the session to "Yes" ? is this the back button added through the "Submit button" element ?

    I tested here by adding a back button to the 2nd page in the demo form I attached earlier and it works fine, clicking it returns me to the first page and all the data are still there, so I can't understand why it doesn't work for you.

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    wibadd 20 Feb, 2012
    I actually am using what Bob supplied, but I am having issues with it. I have tried the following without success:

    1) Confirmation page code - this works for going back only if No is set on the Session Key, per the prior post from Bob. I also cannot seem to get it to execute the next event upon confirm which is run A.net and display a thanks message.

    2) Adding a Submit Button form element with the Back button enabled underneath a Custom Element with my confirmation page code. Selecting back gives me a webpage expired message.

    3) Adding button code in the Custom Element. This I wasn't entirely sure on, but used what you had sent me in a prior email which was:
    <button type="submit" name="confirmation_page" value="_confirm">Submit</button>
    <button type="submit" name="confirmation_page" value="_back">Cancel</button>
    jmarian1 20 Feb, 2012
    Thanks Max. I'm looking forward to your email. Hope you will send it soon. ๐Ÿ™‚ .. Jenny
    GreyHead 20 Feb, 2012
    Hi,

    I'm stepping aside here - it doesn't help to have Max and I offering different solutions in one thread. There are usually several equally good ways of getting things done in ChronoForms.

    Bob
    jmarian1 20 Feb, 2012
    Thank you Max and Bob for helping. Max, thanks for your patience and for an excellent support. Like what I said in my email, you save me from being crazy just a few seconds away, lol. Thank you and thank you again. A million thanks to both of you Max and Bob for an excellent support.
    Max_admin 21 Feb, 2012
    Hi Bob,

    Thank you, Chad got it solved, the issue was with the Authorize.net action, the transaction was failing and returning the user back to the load event by the "Event loop"!๐Ÿ™‚

    @jmarian, no problems!๐Ÿ™‚

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    jmarian1 12 Apr, 2012
    Hi Max/Bob,

    Sorry but I have to open this post again for the problem using the authorize.net.

    1. The CSSV shows in the bottom of the form instead on the top of the page. How to correct that? Screenshot below:
    [attachment=1]Screen Shot 2012-04-11 at 6.38.30 PM.png[/attachment]

    2. The data entered in the forms are not showing after the page reload for validation. I don't know why.

    Attached is my form for the how each event and actions works. Hope to hear from you soon. I need this to work by tomorrow. Please.....
    GreyHead 12 Apr, 2012
    Hi jmarian1,

    Sorry but it's impossible to tell from the image.

    Bob
    jmarian1 12 Apr, 2012
    Hi Bob,

    I have a multi page form which consist and in order below:

    1. HMTL code (search form - query data from DB)
    2. On Load Event
    3. On Project Data (show all data from the query)
    4. On CreditCardForm (grab data from previous page (On ProjectData) then enter credit card information
    5. On Submit (CSSV for the credit card form and authorize.net)

    I don't know where to look why the error message is in the bottom of the page which is supposed to be on top of the page.

    My authorize.net is in On Submit event.

    On Submit Event order:
    MultiPage
    CSSV
    - OnSuccess
    --Authorize.net Licensed
    ---On Approved
    ----Email
    ----Save Data
    ----Show Thanks Messages
    ---On Declined/On Error (have the same lists below)
    ---Custom Code (include below)
    <?php
    $form->validation_errors[] = $form->data['_PLUGINS_']['authorize_net']['response_reason_text'];
    ?>

    ---Email (declined)
    ---Event Loop (goes back to On CreditCardForm event)
    - OnFail
    ---Event Loop (goes back to On CreditCardForm event)

    Please advice if the order is not correct. I am unable to receive any email as well and no data returning from authorize.net.

    I guess the problem is in my "On Submit event" where actions are not in the right place. Please help. I am willling to give more information if you need. Thanks and hope to hear from you again Bob.
    jmarian1 13 Apr, 2012
    Any help please?
    GreyHead 14 Apr, 2012
    Hi Jmarian1,

    I have no idea whay the error messages appear there. This is a much more complex form than anything I have built with the current version of ChronoForms and I haven't see this happen before.

    Are there any clues if you look at the page source? Looking at the code the errors should display immediately after the form tags and before the form content.

    Bob
    jmarian1 18 Apr, 2012
    Hi Bob,

    I agree. My form is too complicated and I myself can't explain either why it is acting like that but it is fix now. Somehow, using one form with the multipage which includes credit card transaction make the error in the bottom. But when I remove the credit card transaction, create a new form for it and call it after, the error message appear on the top. Anyway, I am just glad that it works. Thanks.
    ljk 14 Jan, 2014

    Hi Gerald,

    I haven't done this yet so you are out exploring.

    I think that the answer is like this (I'd use very simple forms to test the flow first):
    [list=a]

  • Set up the four forms and check that they work at the basic level

  • Add a Data to Session action to Form 1

  • Add a ReDirect URL Action to Form 1 and have it point to form 2

  • Add a Data from Session and a Custom Code to the On Load action of Form 2 and use the Custom Code to check that there is some session data (if not then redirect to form 1)

  • Repeat with Forms 3 & 4

  • Add a Data from Session to the On Submit action of Form 4 and then add the appropriate code to email, save, etc.
  • [/list:o]
    That leaves us with the conditional code for the payment. I think that may need a new 'Fork in the Flow' action. I'll think about that some more. There's probably enough here to keep you going for the moment.

    Bob



    Hi,

    How do you do the following:
    Add Custom Code to the On Load action of Form 2 and use the Custom Code to check that there is some session data (if not then redirect to form 1)

    What do you put in the Custom Code and how do you do the redirect back to form 1?

    Thank you.
    GreyHead 15 Jan, 2014
    Hi ljk,

    I did this recently and added a marker in the User session something like this:
    <?php
    $session =& JFactory::getSession();
    $session->set('page_1', 'done', 'cf_check');
    ?>

    Then you can check that on Page 2, I'd probably user my Event Switcher [GH] but custom code would also do:
    <?php
    $session =& JFactory::getSession();
    $page_1 = $session->get('page_1', '', 'cf_check');
    if ( $page_1 == 'done' ) {
      // do this
    } else {
      // do that
    }
    ?>
    The Show Form action in the Utilities group will let you redirect to another form or form event if the Action box is set to Redirect to Form.

    Bob
    ljk 15 Jan, 2014
    Hi,
    On the first form page in the On Submit I added a Custom Code event with this code:
    <?php
    $session =& JFactory::getSession();
    $session->set('page_1', 'done', 'cf_check');
    ?>


    Then on the second form in the On Load I used your Event Switch Action. In the code I have:
    <?php
    $session =& JFactory::getSession();
    $page_1 = $session->get('page_1', '', 'cf_check');
    if ( $page_1 != 'done' ) {
      return 'event_a';
    }
    ?>

    In Event A I added a Redirect User to the first form page and then a Show Stopper.

    But the form is not redirecting to the first page, if I go to the second form first. I have made sure that I deleted my session cookies.

    I am alos having issues with adding the post variables to the session and then getting them out on the next form. I assume that this is how I would pass the variables from 1 form to the next, add new fields to the user session?

    Any ideas? Do you want to see my forms?

    Thank you.
    GreyHead 16 Jan, 2014
    Hi ljk,

    The code looks OK to me. Have you dumped out $page_1 to see what value it has?

    You can pass data using the ChronoForms Data to Session + Session to Data actions - but you need to set an identifier to pass between forms.

    Bob

    PS By default the Joomla! sessions are stored in the database so clearing cookies probably doesn't have any effect.
    ljk 17 Jan, 2014
    Hi,

    How do I 'dumped out $page_1 to see what value it has'?

    With having multiple forms. In form 1 in the 'On Submit' I have a 'Data to Session'. Then in form 2 in the 'On Load' I have a 'Session to Data' and the debug shows that it has the form fields from form 1. On form 2 in the 'On Submit' I have a 'On Submit'.
    I then fill in the form field on form 2 and do a submit. The debug only shows the form fields from form 2, the fields from form 1 are gone. When I get to form 3 which has the same 'On Load' 'Session to Data' and 'On Submit' 'On Submit'. It only shows the fields from form 2.

    The Data to Session doesn't seem to be passing the data from the previous form on to the next form, only the data from the current form. Do you have to add hidden fields and put the previous form's fields into hidden fields to get them passed on?

    I tried adding a hidden field first_name_2 to form 2. Then in form 2's On Submit added 'Custom Code' box and tried this code to put the first_name into the hidden first_name_2 box, but neither worked.
    
    $jinput = JFactory::getApplication()->input;	
    $first_name = $jinput->getString('first_name', '', 'post');
    $form->data['first_name_2'] = $first_name;
    

    and also
    $session =& JFactory::getSession();
    $first_name_2 = $session->get('first_name', '', 'cf_datafields');
    $form->data['first_name_2'] = $first_name_2;

    Note: cf_datafields is what I have set for the Session Key in the Data to Session and Session to Data fields.

    Thank you for you help.
    GreyHead 18 Jan, 2014
    Hi ljk,

    To dump data variables I add temporary entries in the PHP:
    echo'<div>$var: '.print_r($var, true).'</div>';
    will add a line to the output or
    $app =& JFactory::getApplication();
    $app->enqueuemessage('$var: '.print_r($var, true).'<hr />');
    will add a Joomla! system message to the next page displayed.

    The ChronoForms $form->data array where the current variables are stored is limited in scope to the current "event", not to the current "form". So variables set in one event will be lost unless they are passed to another event in the Session, or as values of form inputs. In your case you probably need a second Session to Data action in the On Submit event.

    I'm not clear what your Custom Code is doing. ChronoForms will automatically add the content of the $_GET and $_POST arrays to the $form->data array for you.

    Bob
    ljk 20 Jan, 2014
    Hi Bob,

    The problem that I am having is that the form data from the first page is not being passed on to the third page, only the form data from the second page is passed to the third page. Form 1 have 4 form fields, they get into Form 2, but they don't get passed on to Form 3. I need all the form fields from all the previous Forms to be passed on to the next form.

    I have:
    Form 1 - 4 form fields
    Form 2 - 1 form field
    Form 3 - 3 form fields
    Form 4 - 3 form fields
    Form 5 - this form needs all of the above fields to save info to the database.

    But what is happening is the On Load event is showing the form fields from the previous form, but the On Submit is only showing the fields from the current form, so only the current form fields are passed to the next form.

    In each of the forms 2 to 5 I have the first thing in the On Load a 'Session to Data'.
    I each of forms 1 to 4 I have the first thing in the On Submit a 'Data to Session'.

    So what am I missing to get all the data to pass from form to form?

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