• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xsl in javascript

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am currently working on xsl/xml. I have to implement 2 related dropdown select boxes. I get the data as a jdbc resultset which i can very easily parse with <xsl:for-each> consruct. I want to use this in the javascript so that when ever i call the onchange method from the country drop-down the state drop-down will be re-populated with states of the country selected.

i need to implement something like this

<script>
var selcountry=doc.form.selCountry.value;
<xsl:for-each>
when xsl of statecountry=selcountry
<option>state</option>
</xslfor-each>
</script>


Pls tell me how can i do it, and the syntax for the same please.....
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
problem is the xsl is fired before the page is loaded so you would have to reload the page to fill in the second list. You may want to look into an Ajax solution where you can use a transformation, get the values and fill it in.

Eric
 
Nazneen Shaikh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have managed to get the country and states in two different array, and have a a javascript to populate the state select on the basis of the selected country.
The problem that i am facing now is since on page load, the state select box is not populated with any of the states but a default value of "select state" after i have submitted the page and i go to the next page, if from the next i try to come back(history.go(-1)) the value of the state selected earlier is lost, the list is not populated though the country is selected, i get the populated state list, I need to select a different country and then re-select the original one
please help.
I tried putting in a hidden field, and i am storing the value of the selected state ithis hidden field and i am trying to put in a javascript on the basis of that, but even this hidden field value is reset to null on back.
Please help
Thanking in advance
Naz
 
Nazneen Shaikh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
gotcha...this topic may be closed
Managed it with div's
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic