• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Ajax : how to replace another option list?

 
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day everyone, i'm new to ajax, and having my try using prototype

if i have 2 select option list, say seletOption and updateOption , when onchange on seletOption, updateOption will update and change value based on choice of seletOption



the callAjax() function as follow :



my doubt are :

1)how do we update the updateOption ?
2)for generate the choice of updateOption, i was thinking return a xml which contains all value for updateOption in following format



- in prototype, is there a way to parse xml ? or normally how to parse xml in usual?
- is it good to return xml in this case ? any other choices ?

many thanks in advance for guidance
[ October 11, 2006: Message edited by: Nakata kokuyo ]
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nakata kokuyo:
1)how do we update the updateOption ?



The select element has an API that can be used to manipulate it. You should have a JavaScript and HTML DOM reference handy. Without such a reference you will continually struggle.


2)for generate the choice of updateOption, i was thinking return a xml which contains all value for updateOption in following format



Not a great choice. Returning a JSON structure that you can easily traverse with JavaScript would be much easier.

- in prototype, is there a way to parse xml ? or normally how to parse xml in usual?



If you decide to ue XML, you would parse it as usual given the XML document returned by the XHR instance. Prorotype's $A() function will help you traverse node lists.

is it good to return xml in this case ? any other choices ?



See above.
[ October 11, 2006: Message edited by: Bear Bibeault ]
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you and have a nice day, Bear Bibeault ,

do you mind to show me the most useful and frequent reference on javascript and DOM reference as you mentioned ?

thanks again for guidance , bear
 
Bear Bibeault
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Bear Bibeault for the guidance
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi bear, i have figure out how to replace the option list, but somehow i have some question on it , i have xml file in format as follow :


and have 2 option list as follow :
when "myoption" onchange, it will change the option in "changeoption"



and below is the callback function to replace "changeoption" option



this code work fine and it does replace the changeoption, however if i replace the line



to



it didn't give any error but the changeoption list is not change, i did output retLabel and retValue, it show the value correctly ,besides, i also try on using new String(retLabel), but it doesn't help

why is it so ?
thank you
[ October 12, 2006: Message edited by: Nakata kokuyo ]
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic