Form Tools
Multi Page Form - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17)
+--- Thread: Multi Page Form (/showthread.php?tid=1686)



Multi Page Form - zrakotj - Oct 14th, 2011

All -

Sure could use some help ... with a multi-page form.

I am able to successfully complete the setup of a form using FT.

However, FT is only capturing form data from the first page of a three page form.

What am I doing wrong?

Here is my code for the three page form and "thank you" page.

Form Page #1:
PHP Code:
<?php
require_once("x/global/api/api.php");
$fields ft_api_init_form_page("""test");
$params = array(
  
"submit_button" => "submit",
  
"next_page" => "form-2b.php",
  
"form_data" => $_POST
    
);
ft_api_process_form($params);
?>


<!DOCTYPE html>
<html lang="en">
<head>
<title>form</title>    
</head>
  
<body>
  
<!-- Start of FORM -->

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
First Name:  <input type="text" name="FirstName" value="">
<br />
<br />
Last Name:  <input type="text" name="LastName" value="">
<br />
<br />
<input type="submit" name="submit" value="submit">
</form>

<!-- End of FORM -->

</body>
</html> 

Form Page #2:
PHP Code:
<?php
require_once("x/global/api/api.php");
$fields ft_api_init_form_page();
$params = array(
  
"submit_button" => "submit",
  
"next_page" => "form-3b.php",
  
"form_data" => $_POST,
  
"no_sessions_url" => "form-1b.php"
    
);
ft_api_process_form($params);
?>


<!DOCTYPE html>
<html lang="en">

<head>
<title>form</title>
</head>

<body>

<!-- Start of FORM -->

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
Address:  <input type="text" name="Address" value="">
<br />
<br />
City:  <input type="text" name="City" value="">
<br />
<br />
State:  <input type="text" name="State" value="">
<br />
<br />
Zip:  <input type="text" name="Zip" value="">
<br />
<br />
<input type="submit" name="submit" value="submit">
</form>

<!-- End of FORM -->

</body>
</html> 

Form Page #3:
PHP Code:
<?php
require_once("x/global/api/api.php");
$fields ft_api_init_form_page();
$params = array(
  
"submit_button" => "submit",
  
"next_page" => "thank_you_b.php",
  
"form_data" => $_POST,
  
"finalize" => true
    
);
ft_api_process_form($params);
?>


<!DOCTYPE html>
<html lang="en">
<head>
<title>form</title>
</head>

<body>

<!-- Start of FORM -->

<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
Email:  <input type="text" name="Email" value="">
<br />
<br />
Telephone:  <input type="text" name="Telephone" value="">
<br />
<br />

<input type="submit" name="submit" value="submit">
</form>

<!-- End of FORM -->

/body>
</html> 

Thank You Page:
PHP Code:
<?php
require_once("x/global/api/api.php");
$fields ft_api_init_form_page();
ft_api_clear_form_sessions();
?>

<!DOCTYPE html>
<html lang="en">
<head>
<title>form</title>
</head>

<body>
Thank you.
</body>
</html> 

Many thanks for the assistance.

Jeff -


RE: Multi Page Form - Ben - Oct 15th, 2011

Hi Jeff,

That looks totally fine! But I see you haven't gone through the Test Submission step in the Add Form process (the first page is still passing "test" as the second param to the ft_api_init_form_page() function) - so nothing would be getting stored yet. And since you're not re-entering the form field data for the user into the form fields when they return to a previous page, it'll always look like the data isn't getting stored.

Have you checked out this tutorial? That explains how to re-fill your form fields:
http://docs.formtools.org/tutorials/api_refilling_form_fields/

Let me know if I'm off the mark on any of this!

- Ben


RE: Multi Page Form - zrakotj - Oct 20th, 2011

(Oct 15th, 2011, 3:08 PM)Ben Wrote: Hi Jeff,

That looks totally fine! But I see you haven't gone through the Test Submission step in the Add Form process (the first page is still passing "test" as the second param to the ft_api_init_form_page() function) - so nothing would be getting stored yet. And since you're not re-entering the form field data for the user into the form fields when they return to a previous page, it'll always look like the data isn't getting stored.

Have you checked out this tutorial? That explains how to re-fill your form fields:
http://docs.formtools.org/tutorials/api_refilling_form_fields/

Let me know if I'm off the mark on any of this!

- Ben


Ben -

Many thanks for your help. Please excuse my tardiness in replying to your message.

I will attempt to re-submit the form as you suggest and will circle back with my results.

Again, thank you.

Jeff -

Ben -

I have done as you suggested. However, it appears that FT is having a tough time identifying my form's field types ...

[Image: field_types.png]

Sure could use your help!

Many thanks.

Jeff -

[/php]

(Oct 20th, 2011, 10:43 AM)zrakotj Wrote:
(Oct 15th, 2011, 3:08 PM)Ben Wrote: Hi Jeff,

That looks totally fine! But I see you haven't gone through the Test Submission step in the Add Form process (the first page is still passing "test" as the second param to the ft_api_init_form_page() function) - so nothing would be getting stored yet. And since you're not re-entering the form field data for the user into the form fields when they return to a previous page, it'll always look like the data isn't getting stored.

Have you checked out this tutorial? That explains how to re-fill your form fields:
http://docs.formtools.org/tutorials/api_refilling_form_fields/

Let me know if I'm off the mark on any of this!

- Ben


Ben -

Many thanks for your help. Please excuse my tardiness in replying to your message.

I will attempt to re-submit the form as you suggest and will circle back with my results.

Again, thank you.

Jeff -




RE: Multi Page Form - Ben - Oct 24th, 2011

Hi Jeff,

Sorry to hear that! What version of the Core are you using? The reason I ask is that I made a small but important improvement in 2.1.0 that lets that page detect the fields better.

But no worries, either way. If you - or anyone else - ever get stuck on this step, I'd suggest following the final recommendation in the error message "manually uploading your forms for processing". Just click that link and it will provide you with some file upload fields where you can upload the HTML versions of the pages.

To get them, just view each page in your browser, click "View source" (or whatever option your browser has) and save each page as "page1.html", "page2.html" etc. Then upload those files.

It's a definite workaround, but it should let Form Tools identify the fields properly.

Let me know how it goes!

- Ben


RE: Multi Page Form - zrakotj - Oct 25th, 2011

Ben -

Thanks for the follow-up.

I'm using version 2.1.5.

I will give your suggested recommendation a try and circle back to you.

Many thanks.

Jeff -


(Oct 24th, 2011, 10:05 AM)Ben Wrote: Hi Jeff,

Sorry to hear that! What version of the Core are you using? The reason I ask is that I made a small but important improvement in 2.1.0 that lets that page detect the fields better.

But no worries, either way. If you - or anyone else - ever get stuck on this step, I'd suggest following the final recommendation in the error message "manually uploading your forms for processing". Just click that link and it will provide you with some file upload fields where you can upload the HTML versions of the pages.

To get them, just view each page in your browser, click "View source" (or whatever option your browser has) and save each page as "page1.html", "page2.html" etc. Then upload those files.

It's a definite workaround, but it should let Form Tools identify the fields properly.

Let me know how it goes!

- Ben


Ben -

Unfortunately, the work around did not work.

I continue to run into the same problem. Please note that I changed all four of the form pages from .php to .html for manually uploading the form.

Then, upon successfully configuring the form, changed the form page extensions back to .php (from .html), and resubmitted the entire multipage form. However, FT only picked up on the form values from the first page of the three page form.

Might you have any additional thoughts?

Looking forward to hearing from you.

Thanks.

Jeff -



(Oct 25th, 2011, 12:19 PM)zrakotj Wrote: Ben -

Thanks for the follow-up.

I'm using version 2.1.5.

I will give your suggested recommendation a try and circle back to you.

Many thanks.

Jeff -


(Oct 24th, 2011, 10:05 AM)Ben Wrote: Hi Jeff,

Sorry to hear that! What version of the Core are you using? The reason I ask is that I made a small but important improvement in 2.1.0 that lets that page detect the fields better.

But no worries, either way. If you - or anyone else - ever get stuck on this step, I'd suggest following the final recommendation in the error message "manually uploading your forms for processing". Just click that link and it will provide you with some file upload fields where you can upload the HTML versions of the pages.

To get them, just view each page in your browser, click "View source" (or whatever option your browser has) and save each page as "page1.html", "page2.html" etc. Then upload those files.

It's a definite workaround, but it should let Form Tools identify the fields properly.

Let me know how it goes!

- Ben




RE: Multi Page Form - streamcities - Dec 14th, 2011

I set up a multipage form, but the form will not go to the next page when I click the submit button. I am puzzled! I see others have had issues with Javascript, so I removed mine but it still does not work. When clicked, the page goes blank.


Here's a sample: http://topnotchdoc.com/spine_quiz_p1.php


Below is my code. Thanks!
Jay ;-)


<html lang="en">

<head>

<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/forms.css" rel="stylesheet" type="text/css" />

<?php
require_once("path/to/form_tools/global/api/api.php");
$fields = ft_api_init_form_page("1", "initialize");
$params = array(
"submit_button" => "Volgende",
"next_page" => "spine_quiz_p2.php",
"form_data" => $_POST,
);
ft_api_process_form($params);
print_r($fields);

?>

</head>
<div id="header"></div>
<div id="content">
<div id="logo"><img src="/images/header.png" /></div>
<form id="1" class="appnitro" enctype="mulitpart/form-data" form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
<h1>Back & Neck Pain Questionnaire</h1></center>

<br />
<p>Choose areas where you have pain</p>
<div id="fbody">
<fieldset>
<legend></legend>
<div id="head"><label for="head"> <input type=checkbox name="head"> Head </label></div>
<div id="neck"><label for="neck"> <input type=checkbox name="neck"> Neck </label></div>
<div id="shoulder"><label for="shoulder"> <input type=checkbox name="shoulder"> Shoulder </label></div>
<div id="midback"><label for="midback"> <input type=checkbox name="mid-back"> Mid Back </label></div>
<div id="arm"><label for="arm"> <input type=checkbox name="arm"> Arm </label></div>
<div id="lowerback"><label for="lowerback"> <input type=checkbox name="lower-back">Lower Back </label></div>
<div id="hip"><label for="hip"> <input type=checkbox name="hip">Hip </label></div>
<div id="hand"><label for="hand"> <input type=checkbox name="hand"> Hand </label></div>
<div id="leg"><label for="leg"> <input type=checkbox name="leg"> Leg </label></div>
<div id="foot"><label for="foot"> <input type=checkbox name="foot"> Foot </label></div>
</fieldset>
<div id="buttons">
<p class="small"><sup>*</sup> denotes a required field.</p>
<input type="submit" id="Submit" name="Volgende" value="Volgende" class="awesome">
<input type="submit" name="next_page" value="Next Page" class="awesome" />




</div>

</form>
</div>



RE: Multi Page Form - Ben - Dec 17th, 2011

Hi Jay,

Ah! The "submit_button" => "Volgende" key-value pair in your $params var needs to be changed to
"submit_button" => "next_page".

You needed to enter the name attribute of the submit button, not the value. Hope that helps!

Jeff - sorry, I didn't catch your response - it's generally a better idea to create new posts rather than edit existing ones, otherwise they're likely to get missed.

In the unlikely event that this is still an issue, just post back. Apologies!

- Ben