?
Solved

How to get rid of the windows internet explorer page error?

Posted on 2008-11-14
7
Medium Priority
?
543 Views
Last Modified: 2012-05-05
I wrote a simple form using javascript to collect feedback via email. It normally works and brings up the new email form ready to be sent. However, once it is loaded, on the bottom left of the html page , I have noticed a yellow triangle /  a warning icon with a ! sign in it "error on the page" or "Done" message. Once I double clicked that triangle, it indicates that I had a problem at Line 70 Char 1 Error" "Object expected" Code: 0 I went over the script, I was unable to find anything major at line 70, yet the script seems like working. How can I get rid of that yellow triangle with error message: "Problems with this web page might prevent it from being displayed properly ....etc? Can you check my script and show me what I missed or didn't see?
Secondly: Everytime the form is submitted, the internet explorer generates message saying "This form is being submitted using email.....etc, How can I get rid of this message? Is there any specific javascript code to be added in the page? Please see my script
Thanks for your help, God Bless
<HTML>
<HEAD>
 
<SCRIPT LANGUAGE="JavaScript">
 
 
<!-- Begin
 
function leaptoIntro() {
window.location="http://yahoo.com"
}
 
 
function submitForm() {
if ( (isName()) && (isSuggestion()) && (isRole()) ) {
if (confirm("\nYour submission is about to be sent.\n\nClick YES to submit.\n\nClick NO to cancel.")) 
return true
else
return false;      
}
else
return false;
}
 
function isName() {
var str = document.forms[0].elements[1].value;
if (str == "") {
alert("\nThe NAME field is blank.\n\nPlease enter your name.")
document.forms[0].elements[1].focus();
return false;
}
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') {
alert("\nThe NAME field only accepts letters & spaces.\n\nPlease re-enter your name.");
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
   }
}
return true;
}
 
function isRole() {
var str = document.forms[0].elements[2].value;
if (str == "") {
alert("\nThe Role field is blank.\n\nPlease enter your role.")
document.forms[0].elements[2].focus();
return false;
}
else
return true;
}
 
function isSuggestion() {
var str = document.forms[0].elements[3].value;
if (str == "") {
alert("\nThe SUGGESTION field is blank.\n\nPlease enter your suggestion.")
document.forms[0].elements[3].focus();
return false;
}
else
return true   
}
// End -->
 
</SCRIPT>
 
 
<BODY onLoad="Reset()">
 
<CENTER>
<FORM ENCTYPE="text/plain" NAME="test" METHOD='POST' ACTION='mailto:someone@some.com?subject= Support Feedback' onSubmit="return submitForm()">
<INPUT TYPE ="hidden" NAME = "Form Request" VALUE = " Suggestions">
<TABLE BORDER=0 WIDTH=564>
<TR>
<TD align="center"> <FONT><STRONG>Enter your name:</STRONG></FONT>
<TD align="center"> <FONT><STRONG>Your Role:</STRONG></FONT>
</TR>
<TR>
<TD align="center"> <INPUT TYPE = "text" NAME = "Name"   SIZE=26 MAXLENGTH=40>
<TD align="center"> <INPUT TYPE = "text" NAME = "Role"   SIZE=26 MAXLENGTH=40>
</TR>
</TABLE>
<BR>
<TABLE BORDER=0>
<TR>
<TD align="center"> <FONT><STRONG>Enter your Feedback: </STRONG></FONT>
</TR>
<TR>
<TD align="center"><TEXTAREA NAME = "Suggestions" ROWS=2 COLS=55 wrap=yes></TEXTAREA>
</TR>
</TABLE>
<BR><BR>
<TABLE BORDER=0 WIDTH=300>
<TR>
<TD align="center"><INPUT TYPE="submit" VALUE="Submit">
<TD align="center"><INPUT TYPE="reset" VALUE="Reset" onClick="Reset()">
 
<TD align="center"><INPUT NAME="update" TYPE="BUTTON" VALUE="Close" OnClick="leaptoIntro()">
</TR>
</TABLE>
</FORM>
</CENTER>
</HTML>

Open in new window

0
Comment
Question by:edeita2
  • 3
  • 3
7 Comments
 
LVL 15

Accepted Solution

by:
quincydude earned 375 total points
ID: 22962551
You are missing the reset() function in the code, or are you trying to reset the form? You have to use
<BODY onLoad="document.test.reset();">

The same applies to the reset button.
0
 
LVL 15

Expert Comment

by:MMDeveloper
ID: 22962580
this is bad programming practice, try this code and see what happens
function leaptoIntro() {
	window.location="http://yahoo.com";
}
 
 
function submitForm() {
	if ( (isName()) && (isSuggestion()) && (isRole()) ) {
		if (confirm("\nYour submission is about to be sent.\n\nClick YES to submit.\n\nClick NO to cancel.")) {
			return true;
		}
		else {
			return false;
	}
	else {
		return false;
	}
}
 
function isName() {
	var str = document.forms[0].elements[1].value;
	var regExp = /[^a-zA-Z ]/;
	
	if (str == "") {
		alert("\nThe NAME field is blank.\n\nPlease enter your name.");
		document.forms[0].elements[1].focus();
		return false;
	}
	if (regExp.test(str)) {
		alert("\nThe NAME field only accepts letters & spaces.\n\nPlease re-enter your name.");
		document.forms[0].elements[1].select();
		document.forms[0].elements[1].focus();
		return false;
	}
	return true;
}
 
function isRole() {
	var str = document.forms[0].elements[2].value;
	if (str == "") {
		alert("\nThe Role field is blank.\n\nPlease enter your role.");
		document.forms[0].elements[2].focus();
		return false;
	}
	else {
		return true;
	}
}
 
function isSuggestion() {
	var str = document.forms[0].elements[3].value;
	if (str == "") {
		alert("\nThe SUGGESTION field is blank.\n\nPlease enter your suggestion.");
		document.forms[0].elements[3].focus();
		return false;
	}
	else {
		return true
	}
}

Open in new window

0
 
LVL 15

Expert Comment

by:MMDeveloper
ID: 22962595
sorry typo
function leaptoIntro() {
	window.location="http://yahoo.com";
}
 
 
function submitForm() {
	if ( (isName()) && (isSuggestion()) && (isRole()) ) {
		if (confirm("\nYour submission is about to be sent.\n\nClick YES to submit.\n\nClick NO to cancel.")) {
			return true;
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}
 
function isName() {
	var str = document.forms[0].elements[1].value;
	var regExp = new RegExp("/[^a-zA-Z ]/", "g");
	
	if (str == "") {
		alert("\nThe NAME field is blank.\n\nPlease enter your name.");
		document.forms[0].elements[1].focus();
		return false;
	}
	if (regExp.test(str)) {
		alert("\nThe NAME field only accepts letters & spaces.\n\nPlease re-enter your name.");
		document.forms[0].elements[1].select();
		document.forms[0].elements[1].focus();
		return false;
	}
	return true;
}
 
function isRole() {
	var str = document.forms[0].elements[2].value;
	if (str == "") {
		alert("\nThe Role field is blank.\n\nPlease enter your role.");
		document.forms[0].elements[2].focus();
		return false;
	}
	else {
		return true;
	}
}
 
function isSuggestion() {
	var str = document.forms[0].elements[3].value;
	if (str == "") {
		alert("\nThe SUGGESTION field is blank.\n\nPlease enter your suggestion.");
		document.forms[0].elements[3].focus();
		return false;
	}
	else {
		return true
	}
}

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:quincydude
ID: 22962600
Well, I think using multiple returns is also a bad practise.
0
 
LVL 15

Expert Comment

by:MMDeveloper
ID: 22962610
I agree, I just didn't want to re-engineer it all :P
0
 

Author Closing Comment

by:edeita2
ID: 31516896
quincydude, what do you think about my 2nd question:when form is submitted, the dialog appears and says:(Microsoft Internet Explorer)
"This form is being submitted using email.
Submitting this form will reveal your email address to the recipient and will send the form data without encrypting it for privacy.
You may continue or cancel this submission." is there any way to avoid this or is it simply browser settings?
0
 
LVL 15

Expert Comment

by:quincydude
ID: 22973040
For the second question, it's a IE security setting and can fixed by adjusting the preferences. However, you do not have the rights to adjust your users setting, so everyone will be able to see it anyway,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question