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 19th, 2009, 12:39 PM
cooperljrh cooperljrh is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Location: Jacksonville
Posts: 328 cooperljrh User rank is Sergeant (500 - 2000 Reputation Level)cooperljrh User rank is Sergeant (500 - 2000 Reputation Level)cooperljrh User rank is Sergeant (500 - 2000 Reputation Level)cooperljrh User rank is Sergeant (500 - 2000 Reputation Level)cooperljrh User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 8 h 27 m 45 sec
Reputation Power: 10
Send a message via AIM to cooperljrh Send a message via Yahoo to cooperljrh
Javascript

Hey all, i've pulled out a segment of a checkForm function i am using that is giving me problems.

The form we are using, if a user chooses option 1 or 3 in field "description" then i dont want to check for the selection for "type"

im not necessarily tied to using the switch, but its the last thing i tried.

any help would be great!

Code:
<% fieldName = "description"
errorMessage = "Description is Required" %>

var n;
n = frm.<% = fieldName %>.selectedIndex;

	switch(n)
	{
		case 1:
			proceedCheck = false
		case 2:
			proceedCheck = true
		case 3:
			proceedCheck = false
		case else:
			alert('Shouldnt land here');
	}
	
	if (proceedCheck == true)
	{
		<% fieldName = "type"
		errorMessage = "Payment Type is Required" %>
		if (frm.<% = fieldName %>.selectedIndex == 0)
		{
			alert("<% = errorMessage %>");
			frm.<% = fieldName %>.focus();
			return false;
		}
	}

Reply With Quote
  #2  
Old October 19th, 2009, 01:43 PM
MEdelman MEdelman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 42 MEdelman User rank is Corporal (100 - 500 Reputation Level)MEdelman User rank is Corporal (100 - 500 Reputation Level)MEdelman User rank is Corporal (100 - 500 Reputation Level)MEdelman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 15 h 58 m 33 sec
Reputation Power: 2
What's Not Working?

I can't tell from your message what is not working. If you could provide more details, as well as a "View Source" from a broken page, that might help.

Reply With Quote
  #3  
Old October 20th, 2009, 11:15 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 48th Plane (28500 - 28999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 28,838 Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)  Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 1 Day 14 h 30 m 10 sec
Reputation Power: 2389
you're on the right direction, just missing the "break" keyword:
Code:
switch(n)
	{
		case 1:
			proceedCheck = false;
			break;
		case 2:
			proceedCheck = true;
			break;
		case 3:
			proceedCheck = false;
			break;
		case else:
			alert('Shouldnt land here');
	}

without break, the switch command will simply go to the last "case" block, always.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > 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





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek