Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

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 Codewalkers Forums Sponsor:
  #1  
Old April 9th, 2008, 01:41 AM
wilorichie wilorichie is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Brisbane
Posts: 151 wilorichie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 3 m 8 sec
Reputation Power: 2
Works but error

I have a chain selection that works, but since I have upgraded to the new IE. It seems to crash IE when the value is null. It also comes up with an error icon on the bottom left.

This is based on a tutorial I did a couple of years back.

Can anyone see my error?

Code:
<form action="#" method="post" name="categories">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
  <tr>
	<td class="form_title" colspan="2"><span class="text_header">Add Product</span></td>
  </tr>
  <tr>
	<td class="reg_form_left"><span class="text_main"><strong>Category:</strong></span></td>
	<td class="body_text_area"><select class="input_box" name="cat" id="cat" onChange="updatesubcat(this.selectedIndex)">
	  <option selected value="0">Please Select</option>
	  <option value="8">Eyelash Tinting/Perming</option><option value="5">Face, Hand & Body Care</option><option value="1">French Clay & Accessories</option><option value="6">Hair Accessories</option><option value="9">Nails</option><option value="10">Pedicure</option><option value="2">Retail</option><option value="11">Salon Furniture</option><option value="3">Tanning</option><option value="4">Terry Towelling & Accessories</option>				</select></td>
  </tr>
  <tr>
	<td class="reg_form_left"><span class="text_main"><strong>Sub-Category:</strong></span></td>
	<td class="body_text_area"><select class="input_box" name="subcat" id="subcat">
	</select></td>
  </tr>
  <tr>
	<td class="reg_form_left"><span class="text_main"></span></td>
	<td class="body_text_area"><span class="text_main"><strong><input type="submit" value="Submit" name="submit" id="submit" class="submit_box" /></strong></span></td>
  </tr>
</table>
</form>


<script type="text/javascript">

	var catlist=document.categories.cat
	var subcatlist=document.categories.subcat
	
	var subcat=new Array()
	subcat[0]=[""]
	subcat[1]=["Aroma Indulgence Body Care|1","Balneotherapy Healing Bath Foams|2","Essential Oil Blends|3",]
	subcat[2]=["No Sub-Categories Available|0",]
	subcat[3]=["No Sub-Categories Available|0",]
	subcat[4]=["No Sub-Categories Available|0",]
	subcat[5]=["No Sub-Categories Available|0",]
	subcat[6]=["No Sub-Categories Available|0",]
	subcat[7]=["No Sub-Categories Available|0",]
	subcat[8]=["No Sub-Categories Available|0",]
	subcat[9]=["No Sub-Categories Available|0",]
	subcat[10]=["No Sub-Categories Available|0",]
	
	
	
	function updatesubcat(catgroup){				
		subcatlist.options.length=0					
		if(catgroup>0){					
			for(i=0; i<subcat[catgroup].length; i++)
			subcatlist.options[subcatlist.options.length]=new Option(subcat[catgroup][i].split("|")[0], subcat[catgroup][i].split("|")[1])					
		}				
	}
	
</script>
__________________
- Richie

Reply With Quote
  #2  
Old April 13th, 2008, 06:50 PM
wilorichie wilorichie is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Brisbane
Posts: 151 wilorichie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 3 m 8 sec
Reputation Power: 2
Anyone?

Sorry guys...

Reply With Quote
  #3  
Old April 14th, 2008, 03:21 AM
skym skym is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: Oradea, Romania
Posts: 27 skym User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 37 sec
Reputation Power: 0
Add the following
if (typeof subcat[catgroup][i] != 'undefined')
before the subcatlist.options[... line inside the for loop.
That should resolve the problem, at least in IE6 where I tested.

Reply With Quote
  #4  
Old April 14th, 2008, 07:16 AM
wilorichie wilorichie is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Brisbane
Posts: 151 wilorichie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 3 m 8 sec
Reputation Power: 2
Hey mate... Thanks for that.

That works a charm...

I appoligise for my lack of Javascript knowledge which wasted your time though.

Works. Cheers!

Reply With Quote
  #5  
Old April 14th, 2008, 08:22 AM
skym skym is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: Oradea, Romania
Posts: 27 skym User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 13 m 37 sec
Reputation Power: 0
No problem

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Works but 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 5 hosted by Hostway