Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submission page not working.

Status
Not open for further replies.

JIMBO86

Programmer
Jun 18, 2009
4
US
My pages are not working.

Below is the html page.

Thank you.

<html>

<head>

<title>Woodcrest Parking</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/JavaScript">

<!--

var errorTrue=false;


function checkForm(){

//alert("Hello");

errorTrue=false;

//Check Name and Phone--Value Required

if(petForm.name.value==null || petForm.name.value=="" || petForm.name.value==" "){

errorTrue=true;

}

if(petForm.address.value==null || petForm.address.value=="" || petForm.address.value==" "){

errorTrue=true;

}

if(petForm.city.value==null || petForm.city.value=="" || petForm.city.value==" "){

errorTrue=true;

}

if(petForm.state.value==null || petForm.state.value=="" || petForm.state.value==" "){

errorTrue=true;

}

if(petForm.zip.value==null || petForm.zip.value=="" || petForm.zip.value==" "){

errorTrue=true;

}

/*************DO NOT NEED EMAIL OR PHONE

if(petForm.phone==null || petForm.phone=="" || petForm.phone==" "){

errorTrue=true;

}



//Check E-mail, must be valid E-mail address Format

if(petForm.email==null || petForm.email=="" || petForm.email==" "){

errorTrue=true;

}

*/

//if fields check out, get text of petition

if(!errorTrue){

getPetitionText();

//once data is gathered send the form

sendForm();

}

else{

//send error message

window.alert("Be sure required fields are completed!");

}



}



function sendForm(){

//alert("sending Form");

//alert(petForm.petTextOne.value);

//alert(petForm.petTextTwo.value);

petForm.method="POST";

petForm.action="parking_script.cfm";

petForm.submit();

}

function getPetitionText(){

var introText = document.all.intro.innerText;
var petitionText = document.all.petition.innerText;
var closingText = document.all.petition.innerText;
var endText = document.all.petition.innerText;

petForm.petTextOne.value=introText;
petForm.petTextTwo.value=petitionText;
petForm.petTextThree.value=closingText;
petForm.petTextFour.value=endText;

}

//-->

</script>

</head>

<body bgcolor="#660000" text="#FFFFFF">


<form name="petForm" method="post">

<input type="hidden" name="petTextOne" value="">

<input type="hidden" name="petTextTwo" value="">

<table width="96%" border="7" cellspacing="2" cellpadding="2">

<tr>

<span id="intro">

To: The public officials of Longport and Atlantic county:

<br>

<br>
</span>
<td height="172" colspan="3"
<p align="center">
<span><strong><font size="+1">To the public officials of Longport and Atlantic County.</font></strong></span></p>

<p>
<p align="center">
<span id="petition"> <b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
We the visitors, guests and residents of Longport are sending a copy of this petition to our Atlantic county representatives.<br>
If our Mayor and Commssioners will not or does not listen to our request as listed below, we respectfully request you to lend your support to the residents of Longport,NJ and Atlantic County in our opposition to their resolution.. </b></span>

</p>
<p><span><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size="+2"> &nbsp;To our county and state representives:<br>
Please use your political influnence to stop the elimination of our much needed parking spaces.
</font></b></span></p>
<p>
<b>

<p><span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Thank you! </span></p>
</b>


</tr>
<tr>
<td width="72%" rowspan="2"><p><span>&nbsp; Henceforth, we respectfully request::<br>
</span></p>

<span id="closing">
<ul>
<li><strong>Immediately discontinue the any actions to elimnate parking on Woodcrest Avenue</strong></li>
<br>
<li><strong><u>Stop</u></strong> <strong><u>eliminating</u></strong> available PARKING in Longport.</li>
<br>
<li><strong>Show fairness Longport</strong></li>

<br>
<li>Most importantly,&nbsp; <strong>Let us park our cars in peace !!! </strong>
<ul>
<br>
</ul>
<br> </span>

<span id="end"> If you agree, after reading the above petition, please fill in your name and pertinent
information at the bottom. </span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
(Then hit the <b> <i> <strong><u>SEND PETITION</u></strong></i>&nbsp;&nbsp; button. ) <br>
</b></li>

</ul>
</span></td>
<td width="28%" height="151" bgcolor="#FFFFFF">
<div align="center"><img src="/IMAGES/usa.gif" width="132" height="99"><img src="file:///%20HD-OS-9/IMAGES/AMERICAN%20FLAGS.gif" width="1" height="1"></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><img src="/IMAGES/njflag.gif" width="132" height="99"></div></td>
</tr>

<tr><td colspan="2">

<div align="left">

<font size="2" face="Arial, Helvetica, sans-serif"><em><b>Name</b> (required)</em></font><br>

</div>

</td>

</tr>

<tr>

<td colspan="2">

<input type="text" name="name" size="40">

</td>

</tr>

<tr>

<td colspan="2">&nbsp; Address <font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>

</tr>

<tr>

<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="12%">Address:</td>

<td width="24%"><input name="address" type="text" id="address" size="40"></td>

<td width="8%">&nbsp;</td>

<td width="6%">&nbsp;</td>

<td width="5%">&nbsp;</td>

<td width="45%">&nbsp;</td>

</tr>

<tr>

<td>City:</td>

<td><input name="city" type="text" id="City" size="40"></td>

<td><div align="right">

State:

</div></td>

<td><input name="state" type="text" id="state" value="NJ" size="5"></td>

<td><div align="right">

Zip:

</div></td>

<td><input name="zip" type="text" id="zip" size="12"></td>

</tr>

</table>

</td>

</tr>

<tr>

<td colspan="2">

<div align="left">

<font size="2" face="Arial, Helvetica, sans-serif"><em>E-Mail (optional)</em></font>

</div>

</td>

</tr>

<tr>

<td colspan="2">

<input type="text" name="email" size="40">

</td>

</tr>

<tr>

<td colspan="2">

<font size="2" face="Arial, Helvetica, sans-serif"><em>Telephone #</em></font>

<font size="2" face="Arial, Helvetica, sans-serif"><em> (optional)</em></font> </td>

</tr>

<tr>

<td colspan="2">

<input type="text" name="phone" size="40">

</td>

</tr>


<tr>

<td colspan="2">

<input type="button" onClick="checkForm();" value="Send Petition">

</td>

</tr>
</table>

</form>
</body>

</html>

Below is the cold fusion page:

<html><head>
<title>PARKING</title><meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1"></head>
<body><cfmail from="friends@longport.info"
to="JIMBO86@comcast.net"
subject="PARKING" type="html" server="localhost">
<!---Send e-mail with form results--->
<h2>The Following Petition was signed by:</h2>
<strong>#FORM.name#</strong><br>
<br> #FORM.address#<br>
#FORM.city#,
#FORM.state#
#FORM.zip#
<br>
<hr> <p>
#FORM.petTextOne# </p>
<p>
#FORM.petTextTwo#
</p>
<p>
#FORM.petTextThree#
</p>
<p>
#FORM.petTextFour#
</p>


</cfmail><!---INput Database with form results--->
<cfquery datasource="longport_longport_info" name="insertPerson">
INSERT INTO petSigners (name,email,phone,address,city,state,zip)
VALUES ('#FORM.name#','#FORM.email#','#FORM.phone#','#FORM.address#',
'#FORM.city#','#FORM.state#','#FORM.zip#'
)</cfquery><cfoutput>
<div align="center"><strong>Your petition entry has been submitted.
<br>

<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Thank you!</strong><br>
<br>
Any questions please e-mail me at:
<a href="mailto:JIMBO86@COMCAST.NET">Keep it Fair!</a><br>
<br>
<br>
<br>

<a href="Return to our home page</a></div>
</cfoutput></body></html>

Thank you for your help.

Jim
 
My pages are not working

You need to elaborate on that. What is the page currently doing and versus what you expect it to do?

BTW, you might consider using CFFORM instead of a regular html form. Most of the common form validation is already built in, and it is usually more comprehensive than self coded javascript routines.


----------------------------------
 
A copy of the petition is supposed to go to my e-mail (or any e-mails that I send it to.)

It is coming through but the text sections are arriving as undefined.

Example:

The Following Petition was signed by:
test

test
test, NJ 12345

----------------------------------------------------------

undefined

undefined

undefined

undefined



If you want I can ad your e-mail to sent list so you test it.

Thank you.

Jim

 
function getPetitionText(){
var introText = document.all.intro.innerText;
var petitionText = document.all.petition.innerText;
var closingText = document.all.petition.innerText;
var endText = document.all.petition.innerText;

petForm.petTextOne.value=introText;
petForm.petTextTwo.value=petitionText;
petForm.petTextThree.value=closingText;
petForm.petTextFour.value=endText;

}

I am not sure why you need to grab the element text. But if it the values are literally "undefined", it is because of your javascript code. "document.all" is a deprecated syntax that was specific to old versions of Internet Explorer (like 4 and 5). It probably will not work on other browsers like Firefox. Use DOM syntax instead: document.getElementById(...)


But again, I would consider using cfform instead. The current javascript validation is not as robust as it could be.


----------------------------------
 
Is this correct?

It is still not working.


document.getElementById(intro.innerText);


Thanks,

Jim

 
No. You must pass in the element "id" (which is "petition"). Then grab the innerText.

Code:
-- Not tested
var introText = document.getElementById("petition").innerText;



----------------------------------
 
Could you do one line for an example?

Thank you.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top