Re: [OT] JS snippet needed

This WebDNA talk-list message is from

2006


It keeps the original formatting.
numero = 66916
interpreted = N
texte = Donovan, I'm a bit confused about what exactly you're trying to do? Do you have a working example I could look at? I'd be happy to assist, but I'm having a hard time figuring out what the end result should be? Do you want multiple select lists, with a depenency relationship? Are the colors and sizes stored in a database or are you going to hard code them? Maybe something like AJAX or Matt Kruse's DynamicOptionList.js is what you're looking for? http://www.clearnova.com/ajax/ http://www.javascripttoolbox.com/lib/dynamicoptionlist/ Marc Donovan Brooke wrote: > Donovan Brooke wrote: > >> Marc Thompson wrote: >> >>> OK, I couldn't stand it. The code I wrote quickly didn't work so I >>> went ahead fixed. Look here: >>> http://www.utah.edu/wc/choose.html >>> >>> Marc > > > > Hey Marc, > I'm finally getting around to working on this issue again. Thanks for the > code. This is a good start. However, I need to figure out some way > of identifying the right image name based off the color select value. > So, starting from your code below: > > > > -- the function: > > -- > > -- the Call: > > -- > > > > Can this be changed to an array that prepopulates both color and the > image name? > > For example, > Here is some code that populates data to another form select: > -- START CODE: > [!] ** Sample Array > arrayData[0] = 'RED|X Large|' > arrayData[1] = 'Blue|Small|' > arrayData[2] = 'Blue|Large|' > arrayData[3] = 'Blue|XX Large|' > ** [/!] > > function populateData( __COLOR ) { > select = window.document.size_color.__SIZE; > string = ""; > // 0 - will display the new options only > // 1 - will display the first existing option plus the new options > count = 0; > // Clear the old list (above element 0) > select.options.length = count; > // Place all matching categories into Options. > for( i = 0; i < arrayData.length; i++ ) { > string = arrayData[i].split( "|" ); > if( string[0] == __COLOR ) { > select.options[count++] = new Option( string[1] ); > } > } > // Set which option from subcategory is to be selected > // select.options.selectedIndex = 2; > // Give subcategory focus and select it > // select.focus(); > } > -- END CODE > > > > > Notice the pipe delimiter. The code above first matches the color, > then the pulls the value to populate into the other select menu. > I would like to convert this so that I can match the color and pull the > adjacent image name to change the image. I can create the array easy > enough but my javascript is pretty lacking. I'll be working on it > but if anyone can easily tackle it, I'd appreciate it. > > Donovan > > > -- ------------------------------------------- Marc Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  2. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  3. Re: [OT] JS snippet needed ( devaulw@onebox.com 2006)
  4. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  5. Re: [OT] JS snippet needed ( Marc Thompson 2006)
  6. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  7. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  8. Re: [OT] JS snippet needed ( "Bess Ho" 2006)
  9. Re: [OT] JS snippet needed ( Donovan Brooke 2006)
  10. Re: [OT] JS snippet needed ( Marc Thompson 2006)
  11. Re: [OT] JS snippet needed ( Marc Thompson 2006)
  12. Re: [OT] JS snippet needed ( "Dan Strong" 2006)
  13. [OT] JS snippet needed ( Donovan Brooke 2006)
Donovan, I'm a bit confused about what exactly you're trying to do? Do you have a working example I could look at? I'd be happy to assist, but I'm having a hard time figuring out what the end result should be? Do you want multiple select lists, with a depenency relationship? Are the colors and sizes stored in a database or are you going to hard code them? Maybe something like AJAX or Matt Kruse's DynamicOptionList.js is what you're looking for? http://www.clearnova.com/ajax/ http://www.javascripttoolbox.com/lib/dynamicoptionlist/ Marc Donovan Brooke wrote: > Donovan Brooke wrote: > >> Marc Thompson wrote: >> >>> OK, I couldn't stand it. The code I wrote quickly didn't work so I >>> went ahead fixed. Look here: >>> http://www.utah.edu/wc/choose.html >>> >>> Marc > > > > Hey Marc, > I'm finally getting around to working on this issue again. Thanks for the > code. This is a good start. However, I need to figure out some way > of identifying the right image name based off the color select value. > So, starting from your code below: > > > > -- the function: > > -- > > -- the Call: > > -- > > > > Can this be changed to an array that prepopulates both color and the > image name? > > For example, > Here is some code that populates data to another form select: > -- START CODE: > [!] ** Sample Array > arrayData[0] = 'RED|X Large|' > arrayData[1] = 'Blue|Small|' > arrayData[2] = 'Blue|Large|' > arrayData[3] = 'Blue|XX Large|' > ** [/!] > > function populateData( __COLOR ) { > select = window.document.size_color.__SIZE; > string = ""; > // 0 - will display the new options only > // 1 - will display the first existing option plus the new options > count = 0; > // Clear the old list (above element 0) > select.options.length = count; > // Place all matching categories into Options. > for( i = 0; i < arrayData.length; i++ ) { > string = arrayData[i].split( "|" ); > if( string[0] == __COLOR ) { > select.options[count++] = new Option( string[1] ); > } > } > // Set which option from subcategory is to be selected > // select.options.selectedIndex = 2; > // Give subcategory focus and select it > // select.focus(); > } > -- END CODE > > > > > Notice the pipe delimiter. The code above first matches the color, > then the pulls the value to populate into the other select menu. > I would like to convert this so that I can match the color and pull the > adjacent image name to change the image. I can create the array easy > enough but my javascript is pretty lacking. I'll be working on it > but if anyone can easily tackle it, I'd appreciate it. > > Donovan > > > -- ------------------------------------------- Marc Thompson Software Engineer Office of Information Technology University of Utah 801.585.9264 marc.thompson@utah.edu ------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Marc Thompson

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Why doesn't it change? (1998) ThisURL and getting domain/server address (2005) [group] ? (1997) Separate SSL Server (1997) PSC recommends what date format yr 2000??? (1997) EditPlus 2 WebDNA cliptext (2002) Webstar 1.3.1 PPC (1997) question: back button prevention (1997) Pithy questions on webcommerce & siteedit (1997) unable to run webcatalog locally (1998) Tab Charactor (1997) Re:HELP - NONE STOP DIGESTS. Digest for 4/24/97) (1997) Banners (1997) Date problems (1997) PSC recommends what date format yr 2000??? (1997) unix permissions theory applied to db security? Or...? (2000) Trouble with formula.db (1997) [WebDNA] annoucement - WebDNA 8.0.2 (2015) WebCat2: Found Items syntax, etc. (1997) Secure server question (1997)