JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 3rd, 2004, 10:33 AM
SABmore SABmore is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 17 SABmore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 34 sec
Reputation Power: 0
Unhappy Object Undefined Error

I have 6 drop-down boxes that are populated based on the user's previous selection. So if the user selects an item in #1, it will only show corresponding items in #2, so on and so forth. Once the user selects an item in #6, they then move to a textbox, which then refreshes the page in order to get the value selected in #6.

The problem I am encountering is when the user doesn't select any of the drop downs, but then clicks on the textbox. I get the "object undefined" error - which is meaningless to me (especially since the line #'s don't match up). I tried checking for "0", then inserting a default value, but this doesn't work.

Below the javascript functions for both the drop-downs and text box. Any assistance you can provide will be greatly appreciated.
Code:

Drop down:
function setLBValues(whichBoxSelected)
{
	/*
	---------------------------------------------------------------------------------------------
	Set the list box selected values from the hidden form element values. 

	If this invocation was triggered by the static focus() code in the last Javascript (from 
	the server), the bsubmitFocus variable will be false and the form will not be submitted.

	If this invocation was triggered by a setfocus() resulting from a mouse or keyboard event, 
	then bsubmitFocus will be true and the form will be submitted.   
	---------------------------------------------------------------------------------------------
	*/
	theBoxSelected = whichBoxSelected.name.charAt(3);
	var lbStart = parseInt(theBoxSelected);
	document.frmHWSW.lbFocus.value = theBoxSelected;
	if (lbStart < 3)
	{
		endPoint = lbHWEnd;
	}	
	else
	{
		endPoint = lbSWEnd;
	}	

	document.frmHWSW.selBox0.value 		= document.frmHWSW.sel0.selectedIndex;
	document.frmHWSW.selBox1.value 		= document.frmHWSW.sel1.selectedIndex;
	document.frmHWSW.selBox2.value 		= document.frmHWSW.sel2.selectedIndex;
	document.frmHWSW.selBox3.value 		= document.frmHWSW.sel3.selectedIndex;
	document.frmHWSW.selBox4.value 		= document.frmHWSW.sel4.selectedIndex;
	document.frmHWSW.selBox5.value 		= document.frmHWSW.sel5.selectedIndex;
	document.frmHWSW.ListBoxNo.value	= whichBoxSelected.name.charAt(3);
	
		
	if (bsubmitFocus)
	{
		bsubmitFocus = false;
		document.frmHWSW.submit();
	}
	else
	{
		bsubmitFocus = true;
	}
}

Text Box:
function setBox5(whichBoxSelected)
{
	theBoxSelected5 = 5
	var lbStart = parseInt(theBoxSelected5);
	document.frmHWSW.lbFocus.value = document.frmHWSW.HWStartYear;
	document.frmHWSW.selBox5.value = document.frmHWSW.sel5.selectedIndex;
	
	if (bsubmitFocus)
	{
		bsubmitFocus = false;
		document.frmHWSW.submit();
	}
	else
	{
		bsubmitFocus = true;
	}
}

Reply With Quote
  #2  
Old June 3rd, 2004, 05:42 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
On which line is the error occuring? (Show it in your code). Please place code in [code] tags.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old June 6th, 2004, 10:58 AM
SABmore SABmore is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 17 SABmore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 34 sec
Reputation Power: 0
Found Answer, New Question

I figured out my previous post, but now I have a new issue.

After the user makes a selection in the 6 drop-down list, they then click in a textbox. The textbox then fires off an onFocus event, that submits the form (basically a dynamic refresh), and needs to the bring the user's focus back to the textbox. Such as:

document.frmHWSW.submit();
document.frmHWSW.HwStartYear.focus();

The problem I am having is that I can't get it to put the focus back on the textbox. Is it possible to do this?

Thanks!

Reply With Quote
  #4  
Old June 6th, 2004, 06:32 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Once a form is submitted, the page is finished. You need to put your focus() call in the body's onload event.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Object Undefined Error


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 2 hosted by Hostway