Sep 28th, 2011, 12:14 PM
(Sep 28th, 2011, 11:41 AM)Ben Wrote: Hi Dave,
For re-filling form fields when using the API, check out these tutorials:
This one shows the PHP code you need at the top of the page:
http://docs.formtools.org/tutorials/php_...validation
This one shows how to actually re-fill each of the different field types:
http://docs.formtools.org/tutorials/api_...rm_fields/
Re-filling the form fields actually works better with the API, because the data submitted by the user is always available to re-input in the fields.
- Ben
P.S. Boy I can't wait to finally get the Form Builder module released... all of the extra work you need to do to integrate your forms properly, plus all these nit-picky problems that arise from using the API will finally disappear. Oh to have more time...
Yeah, time is definitely a problem. More like a currency and a luxury.
Anyway, I remember trying this before with the Captcha stuff and not having any luck and nothing much has changed. I added just the one field for testing and if you enter an incorrect entry in the Captcha field the page refreshes and you lose the field entries irregardless of having the code in there. At the top, I currently have:
Code:
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/admin/formtools/global/api/api.php");
$fields = isset($_SESSION["form_tools_form_data"]) ?
ft_strip_tags($_SESSION["form_tools_form_data"]) : array();
$fields = ft_api_init_form_page(2);
$params = array(
"submit_button" => "submit",
"next_page" => "/events/entry-thanks.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
?>
Code:
<input type="text" id="contact" name="contact" value="<?=@$fields["contact"]?>" />
Dave