HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 5th, 2004, 12:15 PM
jbruso jbruso is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 279 jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 17 h 31 m 46 sec
Reputation Power: 5
Send a message via AIM to jbruso Send a message via MSN to jbruso Send a message via Yahoo to jbruso
Exclamation Freaking JavaScript!

argh...

can someone please tell me why, oh why does the page continue on when you click ok on the validation alert? It should just stay on the same page, let you fix ur field... ??

Code:
 <script>
function validateForm() {
with (document.frmEnquiry) {
var alertMsg = "The following REQUIRED fields\nhave been left empty:\n";
if (from.value == "") alertMsg += "\nYour e-mail address.";
if (alertMsg != "The following REQUIRED fields\nhave been left empty:\n") {
alert(alertMsg);
return false;
} else {
return true;
} 
} }
</script> 


Code:
 <input onmouseover="this.src='/images/submit_on.gif'" onmouseout="this.src='/images/submit.gif'"
 name="btnSubmit" type="image"  onclick="validateForm()" value="Submit" src="/images/submit.gif" vspace="15" hspace="15" width="136" height="31" border="0"> 

Reply With Quote
  #2  
Old October 5th, 2004, 12:58 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
Example:
Code:
 <script language="JavaScript">
function validateForm()
{
	if (document.frmEnquiry.test.value =='')
	{
		alert("test is empty.");
		return false;
	}
	return true;
}
</script> 
<form name="frmEnquiry" onSubmit="return validateForm();" method="post">
<input type="text" name="test"><br>
<input onmouseover="this.src='/images/submit_on.gif'" onmouseout="this.src='/images/submit.gif'"
 name="btnSubmit" type="image" value="Submit" src="/images/submit.gif" vspace="15" hspace="15" width="136" height="31" border="0"><br>
</form>

Reply With Quote
  #3  
Old October 5th, 2004, 01:35 PM
jbruso jbruso is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 279 jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 17 h 31 m 46 sec
Reputation Power: 5
Send a message via AIM to jbruso Send a message via MSN to jbruso Send a message via Yahoo to jbruso
cool. thanks Mem... you're a lifesaver... I figured out that the reason why my validations were doing this was becuase I didn't have

return validateForm()

man, I need to take a JavaScript class or something... maybe I'll solicit suggestions from the forums...


j

Reply With Quote
  #4  
Old October 10th, 2004, 04:28 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
javascript is really not very complicated or spooky once you dive into its details... learn some C/C++ as it's based on those languages - doing this, you'll catch two birds in one action.

Reply With Quote
  #5  
Old October 10th, 2004, 10:08 AM
Phoenix's Avatar
Phoenix Phoenix is offline
Web-Standards Evangelist
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Posts: 1,522 Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level)Phoenix User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 23 h 48 m 4 sec
Reputation Power: 8
True.... almost

JavaScript was originally known as "LiveScript" (and officially known as "ECMAScript"), but Sun (who at the time had a say in Netscape's development) wanted to increase the hype about their Java platform by renaming the script standard as "JavaScript" as its syntax is losely based on Java itself

with the fully-blown java language based on C++ but with modifications for cross-platform compliance

</brief-history-lesson>

HTH
-1337_d00d

Reply With Quote
  #6  
Old October 11th, 2004, 01:57 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
lol
you forgot <brief-history-lesson> starting tag, by the way...
Now Sun has to pay billion green $$ for the Java... poor ppl ah?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Freaking JavaScript!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway