Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ Custom form not always sending information

Posted by: crc May 31 2008, 09:52 AM

Hello,

I hope I can find someone that's can look over my for on my website and help me solve a few issues. I had my site built about 2 years ago and have made modification to it on a regular basis. At one point I switched hosting companies and have constanly had issues with the form. Anyway I'm sure with me editing my site from time to time I created the problem. I have 2 ways to go, I can either repair the current custom form,sendinfo.php and script.js or use Godaddy.com PHP form mailer. The problem is that this is over my head. Free advice is fine,but if it requires a small fee I'll pay it. From time to time I have applicants call in and ask about the status of thier application and I tell them I didn't recieve thier information. I have tested my form many times and every now and then It doen't work.

My website is www.driverscdlstaffing.com
The page I have an issue with is : http://www.driverscdlstaffing.com/cdl_truck_driver_application.html

My site is hosted by godaddy.com. I haven't been able to understand how to use thier PHP from mailer and support doesn't seem to be able to help me. I attached the documents below if you need them. Any ideas or suggestions will be appreciated.


Thanks,

Curtis Carpenter.


Attached File(s)
Attached File  cdl_truck_driver_application.html ( 59.87k ) Number of downloads: 792
Attached File  sendinfo.php ( 21.05k ) Number of downloads: 555
Attached File  script.doc ( 74.5k ) Number of downloads: 2164

Posted by: Darin McGrew May 31 2008, 12:29 PM

Your form has no action attribute. Please see the FAQ entry http://www.htmlhelp.com/faq/html/forms.html#form-howto

Posted by: crc May 31 2008, 06:39 PM

QUOTE(Darin McGrew @ May 31 2008, 01:29 PM) *

Your form has no action attribute. Please see the FAQ entry http://www.htmlhelp.com/faq/html/forms.html#form-howto



Thanks, I've tried everything and still no luck. I inserted this below and it doesn't work at all. This is what godaddy.com says do.



To Use webformmailer.php
Create a Web form, assigning unique names to your form fields.
In the form tag, assign /webformmailer.php to the action attribute and set the form method to post:


<form action="/webformmailer.php" method="post">
In addition to the form fields you create, there are three hidden elements you can use.
form_format determines in what format the information is delivered. Its values are 'text', 'csv', 'html', 'xml', and 'default' (same as 'text').

form_order dictates in what order the fields are reported. Its values are 'default' (the same order as they appear on in the form), 'alpha' (alphabetized by field name) or a comma-separated, case-sensitive list of all or some field names.

form_delivery determines the frequency and packaging of deliver. To receive one email per form submission, the form_delivery values are 'default' (every 15 minutes), 'hourly', and 'daily'. To have receive all submissions in an attachment of one email, the form_delivery values are 'digest', 'hourly_digest', and 'daily_digest'.

For example:

<form action="/webformmailer.php" method="post">
<input type="hidden" name="subject" value="Submission" />
First Name: <input type="text" name="FirstName" />
Last Name :<input type="text" name="LastName" />
Email: <input type="text" name="email" />
Comments: <textarea name="comments" cols="40" rows="10">
Type comments here.</textarea>
<input type="submit" name="submit" value="submit"/>
<input type="hidden" name="form_order" value="alpha"/> <input type="hidden" name="form_delivery" value="hourly"/> <input type="hidden" name="form_format" value="html"/> </form>

Still no luck! I've done all I can do.


Thanks,

Curtis Carpenter

Posted by: Darin McGrew May 31 2008, 06:46 PM

I can't see your change. What happens when you submit the form using that markup?

Posted by: crc May 31 2008, 08:26 PM

QUOTE(Darin McGrew @ May 31 2008, 07:46 PM) *

I can't see your change. What happens when you submit the form using that markup?



It just refreshes the page and no data sent.

Posted by: Darin McGrew May 31 2008, 09:17 PM

That sounds like what it does now, with no action attribute. Are you sure you updated the form correctly? Can you post the URL (address) of a document that shows your best attempt?

Posted by: pandy Jun 1 2008, 01:40 AM

Also, what script do you want to use? The sendinfo.php you posted ot your host's?

Posted by: crc Jun 1 2008, 06:55 AM

QUOTE(Darin McGrew @ May 31 2008, 10:17 PM) *

That sounds like what it does now, with no action attribute. Are you sure you updated the form correctly? Can you post the URL (address) of a document that shows your best attempt?



Good Morning! With the form setup like it is now it has worked 5 times in a row for me. I don't know how to post the URL address of a document. The reason I changed it back to the way it was is because it wasn't working at all. Thanks for your help. I'm going to insert the code given to me by godaddy.com and I'll copy and paste it below. Is there anything that needs to be changed on the sendinfo.php or script.js files? With the code just like it is now it's works most of the time, which I don't understand because you and a few other people told me that I needed a action attribute added. So I added this and it just sends me to the homepage with no data sent.

This is what I installed which dosen't work. <form action="/webformmailer.php" method="post">.

Sounds like I truly have a custom form that's a nightmare. To answer your question, No I'm not certain I'm installing it correctly. Since this is a forum and it says no commercial solicatation, Am I out of line to offer to pay a fee? Ifso, I'll need to know the fee to make sure I can afford the fee!

Thanks,

Curtis Carpenter.
678-840-2315

Posted by: crc Jun 1 2008, 07:17 AM

QUOTE(pandy @ Jun 1 2008, 02:40 AM) *

Also, what script do you want to use? The sendinfo.php you posted ot your host's?

I really don't care, I just want it to work, but ideally since it's a custom form that's sends a popup confirmation box upon submittal that states that the information was sent. probably the sendinfo would be best. Remember I don't know so anything I'm saying is a guess at best. I can make changes but it doesn't mean I understand them when it comes to forms. I just changed it to this:
<form id="form" class="style6 "style="margin-top:0px"form action="/formailer.php" onsubmit="return terms()">

It worked, but I'm not sure it will work every time, but it also worked most of the time without the
form action="/formailer.php" added. So I guess i try it several times throughout the day to see if it works everytime.

Thanks,

Curtis Carpenter

Posted by: pandy Jun 1 2008, 09:56 AM

It cannot work without an action.

Well, if you want to use your own script you should put the path to that in the action.

Posted by: Christian J Jun 1 2008, 04:20 PM

QUOTE(crc @ Jun 1 2008, 02:17 PM) *

I just changed it to this:
<form id="form" class="style6 "style="margin-top:0px"form action="/formailer.php" onsubmit="return terms()">

The syntax is slightly incorrect (not only in the example but also on the web page).

Posted by: crc Jun 1 2008, 08:42 PM

QUOTE(pandy @ Jun 1 2008, 10:56 AM) *

It cannot work without an action.

Well, if you want to use your own script you should put the path to that in the action.


OK, That sounds good, but I don't know what to put. Any help will be gretatly appreciated.


Thanks,

Posted by: crc Jun 1 2008, 08:46 PM

QUOTE(Christian J @ Jun 1 2008, 05:20 PM) *

QUOTE(crc @ Jun 1 2008, 02:17 PM) *

I just changed it to this:
<form id="form" class="style6 "style="margin-top:0px"form action="/formailer.php" onsubmit="return terms()">

The syntax is slightly incorrect (not only in the example but also on the web page).



What is the correct syntax? I do understand just a little but most of this is greek to me. any help will be greatly appreciated! Thanks for your input.

Posted by: Darin McGrew Jun 1 2008, 10:23 PM

As far as I can tell, your form is submitting data to your /sendinfo.php just fine. Do you see anything in the server error files?

Posted by: Christian J Jun 2 2008, 05:42 AM

QUOTE(crc @ Jun 2 2008, 03:46 AM) *

What is the correct syntax? I do understand just a little but most of this is greek to me. any help will be greatly appreciated! Thanks for your input.

There's an extra "form" right before the ACTION attribute:

CODE
<form id="form" class="style6 "style="margin-top:0px"form action="/formailer.php" onsubmit="return terms()">


Also I can't remember if you're allowed to leave out spaces between attributes, such as between CLASS and STYLE here:

CODE
class="style6 "style="margin-top:0px"

(the validator seems to accept it), but it might confuse some browsers.

BTW there's no METHOD attribute specified. The default value is GET, is that intended? (I only took a quick look at the attached PHP script.) See also http://www.htmlhelp.com/reference/html40/forms/form.html

Posted by: pandy Jun 2 2008, 08:57 AM

QUOTE(crc @ Jun 2 2008, 03:42 AM) *


OK, That sounds good, but I don't know what to put. Any help will be gretatly appreciated.


The URL to your script.

Posted by: crc Jun 2 2008, 09:31 AM

QUOTE(Christian J @ Jun 2 2008, 06:42 AM) *

QUOTE(crc @ Jun 2 2008, 03:46 AM) *

What is the correct syntax? I do understand just a little but most of this is greek to me. any help will be greatly appreciated! Thanks for your input.

There's an extra "form" right before the ACTION attribute:

CODE
<form id="form" class="style6 "style="margin-top:0px"form action="/formailer.php" onsubmit="return terms()">


Also I can't remember if you're allowed to leave out spaces between attributes, such as between CLASS and STYLE here:

CODE
class="style6 "style="margin-top:0px"

(the validator seems to accept it), but it might confuse some browsers.

BTW there's no METHOD attribute specified. The default value is GET, is that intended? (I only took a quick look at the attached PHP script.) See also http://www.htmlhelp.com/reference/html40/forms/form.html



Thanks, I changed it to this:

<form id="form"class="style6"style="margin-top:0px"action="sendinfo.php"onsubmit="return terms()">

I cleared the spaces and tried the app and it seem to work OK. But you brought up an interesting argument that style and class code might confuse some browsers. How would I correct this and still keep the same style. As far as the get action, I tried that and I keep getting a internal configuration error message when I hit submit. Anytime I remove return trems() the form doesn't work. I believe my form , script, and sendinfo.php are all custom and they require much more knowledge that I have to make them work. The guy that wrote the custom form and files is no longer around , so I'm having to try and correct myself. So if the class and style can confuse browsers how would correct that and get the same style where needed? Here's the 1st few line on mt sendinfo.php file:

<?php
if (! $_GET) {
$_GET = "$HTTP_GET_VARS";
}

if (! $_POST) {
$_POST = "$HTTP_POST_VARS";
}

if (! $_SERVER) {
$_SERVER = "$HTTP_SERVER_VARS";
}


Does this tell you anything?

Thanks

Posted by: pandy Jun 2 2008, 10:36 AM

QUOTE
<form id="form"class="style6"style="margin-top:0px"action="sendinfo.php"onsubmit="return terms()">

This would be a tad more readable.

HTML
<form id="form" class="style6" style="margin-top:0px" action="sendinfo.php" onsubmit="return terms()">


I don't think spaces between attributes are needed if their values are qouted, but I couldn't read a page of code run together like that. Worse was that you had added spaces inside the attibute values. Did those things really work?

QUOTE
class="style6 "


Browsers aren't confused about style and class per see. I think Christian meant that your unorthodox quoting and spacing might confuse them. wink.gif

Posted by: crc Jun 2 2008, 11:15 AM

QUOTE(pandy @ Jun 2 2008, 11:36 AM) *

QUOTE
<form id="form"class="style6"style="margin-top:0px"action="sendinfo.php"onsubmit="return terms()">

This would be a tad more readable.

HTML
<form id="form" class="style6" style="margin-top:0px" action="sendinfo.php" onsubmit="return terms()">


I don't think spaces between attributes are needed if their values are qouted, but I couldn't read a page of code run together like that. Worse was that you had added spaces inside the attibute values. Did those things really work?

QUOTE
class="style6 "


Browsers aren't confused about style and class per see. I think Christian meant that your unorthodox quoting and spacing might confuse them. wink.gif



Thanks for the information, I edited the code and spaced it as you suggested. I don't normally work around code so the spacing looked good to me , but since you routinely look at code, I'm sure it looked like a complete mess. That may have been my problem from the very beginning. I'll try this and see if maybe I have better results.

Thanks again

Posted by: crc Jun 2 2008, 03:48 PM

QUOTE(Christian J @ Jun 1 2008, 05:20 PM) *

QUOTE(crc @ Jun 1 2008, 02:17 PM) *

I just changed it to this:
<form id="form" class="style6 "style="margin-top:0px"form action="/formailer.php" onsubmit="return terms()">

The syntax is slightly incorrect (not only in the example but also on the web page).


Hello,

I have made many corrections as suggested but still having problems. I have recieved over 20 emailed forms today but I just had someone call me and tell me that they tried to complete the application and it just refreshed the page and they lost all the input information! Any suggestions? This is the change:<form id="form" class="style6" style="margin-top:0px" action="sendinfo.php" onsubmit="return terms()">. Could it be in the submit part of the form?

Thanks,

Curtis Carpenter

Posted by: Darin McGrew Jun 2 2008, 04:22 PM

What messages are logged in the server error files?

Posted by: crc Jun 2 2008, 04:23 PM

QUOTE(Darin McGrew @ Jun 1 2008, 11:23 PM) *

As far as I can tell, your form is submitting data to your /sendinfo.php just fine. Do you see anything in the server error files?



I'm not sure how to access the server error files!

Thanks!

Posted by: crc Jun 2 2008, 05:35 PM

QUOTE(Darin McGrew @ Jun 2 2008, 05:22 PM) *

What messages are logged in the server error files?



Hello Darin,

I'm sorry but I don't know how access the error file logs. I called support with godaddy.com the hosting company and they were not much help. The problem is strange, I can complete the form several times and it works well, then the next time it just refreshes the page and clears the data. I have recieved many applications today and also I've had 2 people call me and say that the form wasn't working. I really don't know. It seems like if the form worked once then it should work every time. Even before I added the action attribute you suggested the form worked most of the time. I'm totally lost. I even pulled up the archived page on the wayback machine and tried to compare the code. I didn't see any diffeence!

Thanks again,

Curtis Carpenter

Posted by: Brian Chandler Jun 3 2008, 12:06 AM

Here is the <form> tag from your page:

<form id="form" class="style6" style="margin-top:0px" action="sendinfo.php" onsubmit="return terms()">

When this form is submitted, first the javascript hook in onsubmit is called; *if* this returns true, *then* the form parameters will be submitted (whatever the day of the week, air temperature, etc) to sendinfo.php.

So what is "return terms()" supposed to do? (And first, isn't this exactly the same as "terms()", since a call to terms() returns the value returned by terms(), and the js fragment "return terms()" does the same.)

Hmm, here it is:

function terms(){
var frm = document.forms[0];
if (frm.answer.checked == false)
{
alert("You must agree to the Terms Of Use before submitting the form!");
return false;
}
if (validate_app_data() == false)
{
return false;
}
}


Bad naming: it checks the "terms" box has been ticked (Americans say "checked", but this is dreadfully confusing with all the other "checks"), but also checks that the input parameters are valid.

More curious programming:

if (validate_app_data() == false)
{
return false;
}

This returns the value of validate_app_data() *if* it's false, doesn't return anything if it's true. Hmm, *perhaps* the default return is true, but perhaps it isn't well-defined, and different js implementations do different things. Well, replacing this by

return validate_app_data();

might be a good start. But then you need to check the validate function, which is prolix, and full of obscure bits of commenting out. It's quite likely that the form sometimes fails because this not-terribly-well-written checking function goes wrong.

I would throw away the checking function, and let a human decide if the info is ok. Mail address "checking" is notoriously unreliable, for both false positives and negatives: send a confirmation receipt to the mail address, and tell people to check they receive it. (For a start, this appears to reject capital letters in mail addresses, which I believe are perfectly ok.)


Posted by: crc Jun 3 2008, 06:46 AM

QUOTE(Brian Chandler @ Jun 3 2008, 01:06 AM) *

Here is the <form> tag from your page:

<form id="form" class="style6" style="margin-top:0px" action="sendinfo.php" onsubmit="return terms()">

When this form is submitted, first the javascript hook in onsubmit is called; *if* this returns true, *then* the form parameters will be submitted (whatever the day of the week, air temperature, etc) to sendinfo.php.

So what is "return terms()" supposed to do? (And first, isn't this exactly the same as "terms()", since a call to terms() returns the value returned by terms(), and the js fragment "return terms()" does the same.)

Hmm, here it is:

function terms(){
var frm = document.forms[0];
if (frm.answer.checked == false)
{
alert("You must agree to the Terms Of Use before submitting the form!");
return false;
}
if (validate_app_data() == false)
{
return false;
}
}


Bad naming: it checks the "terms" box has been ticked (Americans say "checked", but this is dreadfully confusing with all the other "checks"), but also checks that the input parameters are valid.

More curious programming:

if (validate_app_data() == false)
{
return false;
}

This returns the value of validate_app_data() *if* it's false, doesn't return anything if it's true. Hmm, *perhaps* the default return is true, but perhaps it isn't well-defined, and different js implementations do different things. Well, replacing this by

return validate_app_data();

might be a good start. But then you need to check the validate function, which is prolix, and full of obscure bits of commenting out. It's quite likely that the form sometimes fails because this not-terribly-well-written checking function goes wrong.

I would throw away the checking function, and let a human decide if the info is ok. Mail address "checking" is notoriously unreliable, for both false positives and negatives: send a confirmation receipt to the mail address, and tell people to check they receive it. (For a start, this appears to reject capital letters in mail addresses, which I believe are perfectly ok.)


Hello Brian,


Wow, It's sounds like I've had a poorly written form from the beginning! It appears that the person I had design this form is as clueless as me when it comes to HTML coding and language. I know this looks simple to you but it's greek to me. I can follow instructions,so are you saying I need to remove the word return from ="return terms()">onsubmit on the actual form page? If so what else would I need to edit?

I don't see where you are referring to bad naming: it checks the "terms" box has been ticked. From this point on in your reply you lost me. It all sounds like great advice but after that I'm lost. I have a very basic understanding of what you are saying, but after that I'm not sure when you are referring to the form itself, the sendinfo.php file or the script file. Is it possible for me to call you and try to get a better understanding. If not I appreciate all your help. It sounds like I'm going to have to have the whole form rewritten to be more user friendly for the browsers and humans.


Thanks again,
Curtis Carpenter

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)