FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie, problem setting up form with API
#1
Hello, as the title said, I'm a newbie to Form Tools (great tool by the way and I'm very glad I found it).
I'm trying to set up a form with API using the tool. I have created a registration page and made the necessary amendments to the code . I've also created a "success" page and again made the necessary amendments. I've published both files. Now the problem, I can't seem to send any information - the Add Form routine in Form Tools consistently assures me that it hasn't received any test page submission.
When I hit the "submit" button on my form, the content fields emty, in other words the form clears itself but it does not redirect to the success page.
I've looked carefully at the code and can't find any error in the form page. Would some kind soul please have a look and let me what mistakes I've made?

Man y thanks in advance for any help!

Here's my code for the registration page:

<?php
require_once("/home/lkssvorm/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page(3, "initialize");
$params = array(
"submit_button" => "submit",
"next_page" => "success.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Register</title>
<meta name="generator" content="WYSIWYG Web Builder 8 - http://www.wysiwygwebbuilder.com">
<style type="text/css">
div#container
{
width: 1250px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
background-color: #FFFFFF;
color: #000000;
}
</style>
<style type="text/css">
a
{
color: #0000FF;
text-decoration: underline;
}
a:visited
{
color: #800080;
}
a:active
{
color: #FF0000;
}
a:hover
{
color: #0000FF;
text-decoration: underline;
}
</style>
<style type="text/css">
#wb_Form1
{
background-color: #FAFAFA;
border: 0px #000000 solid;
}
#Editbox1
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Verdana;
font-size: 16px;
text-align: left;
vertical-align: middle;
}
#Editbox2
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Verdana;
font-size: 16px;
text-align: left;
vertical-align: middle;
}
#Editbox3
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Verdana;
font-size: 16px;
text-align: left;
vertical-align: middle;
}
#Editbox4
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Verdana;
font-size: 16px;
text-align: left;
vertical-align: middle;
}
#Editbox5
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Verdana;
font-size: 16px;
text-align: left;
vertical-align: middle;
}
#wb_Text1
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text1 div
{
text-align: left;
}
#wb_Text2
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text2 div
{
text-align: left;
}
#wb_Text3
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text3 div
{
text-align: left;
}
#wb_Text4
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text4 div
{
text-align: left;
}
#wb_Text5
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text5 div
{
text-align: left;
}
</style>
<script type="text/javascript">
<!--
function Validateform1(theForm)
{
var regexp;
if (theForm.Editbox1.value == "")
{
alert("Please enter a value for the \"Editbox1\" field.");
theForm.Editbox1.focus();
return false;
}
if (theForm.Editbox1.value.length < 1)
{
alert("Please enter at least 1 characters in the \"Editbox1\" field.");
theForm.Editbox1.focus();
return false;
}
if (theForm.Editbox2.value == "")
{
alert("Please enter a value for the \"Editbox2\" field.");
theForm.Editbox2.focus();
return false;
}
if (theForm.Editbox2.value.length < 1)
{
alert("Please enter at least 1 characters in the \"Editbox2\" field.");
theForm.Editbox2.focus();
return false;
}
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (theForm.Editbox3.value.length != 0 && !regexp.test(theForm.Editbox3.value))
{
alert("Please enter a valid email address.");
theForm.Editbox3.focus();
return false;
}
return true;
}
//-->
</script>
</head>
<body>
<div id="container">
<div id="wb_Form1" style="position:absolute;left:258px;top:301px;width:735px;height:375px;z-index:11;">
<form name="form1" method="post" action="<?php echo $_SERVER["PHP_SELF"]?>" enctype="text/plain" id="Form1" onsubmit="return Validateform1(this)">
<input type="text" id="Editbox1" style="position:absolute;left:358px;top:47px;width:338px;height:33px;line-height:33px;z-index:0;" name="Editbox1" value="">
<input type="text" id="Editbox2" style="position:absolute;left:358px;top:101px;width:338px;height:33px;line-height:33px;z-index:1;" name="Editbox2" value="">
<input type="email" id="Editbox3" style="position:absolute;left:358px;top:152px;width:338px;height:33px;line-height:33px;z-index:2;" name="Editbox3" value="">
<input type="text" id="Editbox4" style="position:absolute;left:358px;top:206px;width:338px;height:33px;line-height:33px;z-index:3;" name="Editbox4" value="">
<input type="password" id="Editbox5" style="position:absolute;left:358px;top:258px;width:338px;height:33px;line-height:33px;z-index:4;" name="Editbox5" value="">
<div id="wb_Text1" style="position:absolute;left:50px;top:54px;width:274px;height:18px;z-index:5;text-align:left;">
<span style="color:#000000;font-family:Verdana;font-size:16px;"> First Name</span></div>
<div id="wb_Text2" style="position:absolute;left:50px;top:111px;width:274px;height:18px;z-index:6;text-align:left;">
<span style="color:#000000;font-family:Verdana;font-size:16px;"> Last Name</span></div>
<div id="wb_Text3" style="position:absolute;left:50px;top:164px;width:274px;height:18px;z-index:7;text-align:left;">
<span style="color:#000000;font-family:Verdana;font-size:16px;">email address</span></div>
<div id="wb_Text4" style="position:absolute;left:49px;top:219px;width:274px;height:18px;z-index:8;text-align:left;">
<span style="color:#000000;font-family:Verdana;font-size:16px;"> username</span></div>
<div id="wb_Text5" style="position:absolute;left:50px;top:269px;width:274px;height:18px;z-index:9;text-align:left;">
<span style="color:#000000;font-family:Verdana;font-size:16px;"> password</span></div>
<button id="AdvancedButton1" type="submit" name="" value="" style="position:absolute;left:240px;top:307px;width:298px;height:54px;z-index:10;"><div style="text-align:center"><span style="color:#000000;font-family:Verdana;font-size:16px"> submit</span></div></button>
</form>
</div>
</div>
</body>
</html>
Reply
#2
I'm a newb too but I've been through this a lot over the last little while so I will TRY to help. Sounds like it might be a path issue. Can you post your success.php php code and folder structure where form & success pages reside?

Can you go to the URLs of both the form page & success page in your browser? What is the URL path? Are both the form.php and the success.php in the root of your /public_html/ folder?

It's important to go to the success page BEFORE you submit the test to clear any active sessions. You also require the following code on the success.php

<?php
require_once("/home/lkssvorm/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page();
ft_api_clear_form_sessions();
?>

So you made it to step 3 ... Form Tools gave you the:

$fields = ft_api_init_form_page(3, "initialize");

code and you've put that in your form.php page right?

At that point, and after visiting your success.php page to clear sessions, open the form page in a new browser window and complete all fields then submit the form. That should load 'test submission successful' from Form Tools or something along those lines.

If so, go back to Form Tools admin and click 'refresh' ... then click 'next step' and you should be on your way.
Reply
#3
Hi Pilsnermonkey, thanks for your help.
Just to give a few answers - I have already done all the steps including adding the code to the success.php file. All files can be directly addressed using url in a browser. I have tried visiting the success.php first to clear sessions, I've added in the code from step 3 of the set up and it still don't play with me. I'll have a go at it again later this morning when I get some more time and I'll post up the success.php code and the file structure.
Cheers
Reply
#4
Well I'm just going around in circles here now, getting seriously fed up with it too. This should be a simple process yet I receive no error warnings, nothing to show why this submission won't work and I'm about ready to dump Form Tools - this is costing simply too much time to get done and I'm way behind schedule now.
Sorry for the rant but I'm frustrated.
So here's my set up in more detail, firstly my form - I stripped this down to a simple single edit box and a submit button just to test, code as follows:

<?php
require_once("/home/lkssvorm/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page(1, "initialize");
$params = array(
"Button" => "Submit",
"next_page" => "success.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Page</title>
<meta name="generator" content="WYSIWYG Web Builder 8 - http://www.wysiwygwebbuilder.com">
<style type="text/css">
div#container
{
width: 1250px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
background-color: #FFFFFF;
color: #000000;
}
</style>
<style type="text/css">
a
{
color: #0000FF;
text-decoration: underline;
}
a:visited
{
color: #800080;
}
a:active
{
color: #FF0000;
}
a:hover
{
color: #0000FF;
text-decoration: underline;
}
</style>
<style type="text/css">
#wb_Form1
{
background-color: #FAFAFA;
border: 0px #000000 solid;
}
#wb_Text1
{
background-color: transparent;
border: 0px #000000 solid;
padding: 0;
}
#wb_Text1 div
{
text-align: left;
}
#Editbox1
{
border: 1px #C0C0C0 solid;
background-color: #FFFFFF;
color :#000000;
font-family: Verdana;
font-size: 16px;
text-align: left;
vertical-align: middle;
}
#Button1
{
color: #000000;
font-family: Verdana;
font-size: 16px;
}
</style>
</head>
<body>
<div id="container">
<div id="wb_Form1" style="position:absolute;left:0px;top:0px;width:625px;height:323px;z-index:3;">
<form name="registration" form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST"> <enctype="text/plain" id="Form1">
<div id="wb_Text1" style="position:absolute;left:40px;top:66px;width:238px;height:18px;z-index:0;text-align:left;">
<span style="color:#000000;font-family:Verdana;font-size:16px;"> NAME</span></div>
<input type="text" id="Editbox1" style="position:absolute;left:318px;top:60px;width:269px;height:20px;line-height:20px;z-index:1;" name="Editbox1" value="">
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:258px;top:149px;width:96px;height:25px;z-index:2;">
</form>
</div>
</div>
</body>
</html>

Next my success.php file, again I stripped everything out so this is also just to test:

<?php
require_once("/home/lkssvorm/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page();
ft_api_clear_form_sessions();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>success</title>
<meta name="generator" content="WYSIWYG Web Builder 8 - http://www.wysiwygwebbuilder.com">
<style type="text/css">
div#container
{
width: 1250px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
background-color: #FFFFFF;
color: #000000;
}
</style>
<style type="text/css">
a
{
color: #0000FF;
text-decoration: underline;
}
a:visited
{
color: #800080;
}
a:active
{
color: #FF0000;
}
a:hover
{
color: #0000FF;
text-decoration: underline;
}
</style>
</head>
<body>
<div id="container">
<div id="wb_text_holder_shape" style="position:absolute;left:201px;top:227px;width:820px;height:529px;opacity:0.75;-moz-opacity:0.75;-khtml-opacity:0.75;filter:alpha(opacity=75);z-index:0;">
<img src="images/img0051.gif" id="text_holder_shape" alt="" style="border-width:0;width:820px;height:529px;"></div>
<button id="AdvancedButton2" type="button" onclick="window.location='http://mywebsite/home.html'" name="" value="" style="position:absolute;left:368px;top:462px;width:445px;height:80px;z-index:1;"><div style="text-align:center"><span style="color:#000000;font-family:Verdana;font-size:16px"> Click here to return to Home page</span></div></button>
</div>
</body>
</html>

I have checked the following:

Path to api.php is correct in both files. Both file reside in the root folder of my public_html (I have also checked by entering the path directly into the URL field of the browser and I can directly find both files.

I can't for the life of me find anything wrong yet I am unable to submit the data - on clicking submit the form clears (it appears as if the page reloads) but I am not re-directed to the success.php page and Form Tools does not receive the form data.

Please help me with this if you can!
Thanks

PS If I add the form directly using the direct to process.php method everything works fine, I would much rather use the API method though so any help would be much appreciated. Thanks!
Reply
#5
Error logs on server? system_check utility? See first thread for that.
Reply
#6
Hi,

I already checked the error log, nothing recorded. I also ran the system check utility module, everything checked out fine.
I'm left scratching my head now :-)
Reply
#7
Please add a value to your submit button. In your form change:

<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:258px;top:149px;width:96px;height:25px;z-index:2;">

to:

<input type="submit" id="Button1" name="register" value="Submit" style="position:absolute;left:258px;top:149px;width:96px;height:25px;z-index:2;">

"register" was added to the name parameter.

Then change your PHP to:

<?php
require_once("/home/lkssvorm/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page(3, "initialize");
$params = array(
"submit_button" => "register",
"next_page" => "success.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
?>

Hope this helps.

Cheers,

Joe
Reply
#8
(Feb 5th, 2013, 12:09 PM)Joe Wrote: Please add a value to your submit button. In your form change:

<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:258px;top:149px;width:96px;height:25px;z-index:2;">

to:

<input type="submit" id="Button1" name="register" value="Submit" style="position:absolute;left:258px;top:149px;width:96px;height:25px;z-index:2;">

"register" was added to the name parameter.

Then change your PHP to:

<?php
require_once("/home/lkssvorm/public_html/ftools/global/api/api.php");
$fields = ft_api_init_form_page(3, "initialize");
$params = array(
"submit_button" => "register",
"next_page" => "success.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
?>

Hope this helps.

Cheers,

Joe

Thanks Joe, I'll try the amendments you list and report back to let you know if it works properly afterwards.
Cheers


Well, that has helped to an extent - when I click submit I am now transferred to my success page - a big improvement.
However, the FormTools admin section is still waiting for the data: "Form Tools hasn't received a successful test submission yet. "
I'll double check everything again but I didn't make any changes other than those you suggested and I haven't changed the success.php.

Cheers
Reply
#9
Almost there now, form test submission etc passed, fields created and test submissions made to make sure that the database is being populated - it is, everything seems to be working.
One final step to resolve, form isn't clearing even after visiting the success.php page which contains the correct code. I'll have to double check this aspect.
Thanks to everyone that gave me their assistance in solving this problem.
Cheers
Reply
#10
Glad to hear that everything is working.

Cheers,

Joe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)