populating dropdowns using xml

I am looking for java / jaxb code to populate drop downs based on values in xml

Thanks
hipalAsked:
Who is Participating?
 
CEHJCommented:
Are you sure you're not looking for a javascript solution?
0
 
hipalAuthor Commented:
Well. I can try that too.

please give ify ou have code for that.

My webpage has mulitple drop downs which gets populated from same xml based on different tag porperties. for example

Drop Down 1
Drop down 2

XMl -->
<dropdown name="1">
   <item>
   <item>
</dropdown>
<dropdown name="2">
   <item>
  <item>
</dropdown>

Thanks
0
 
hipalAuthor Commented:
And the value in one drop down changes on the basis on selection in some other drop down.

Do you think is such scenario, javascript will the right/best option ?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
for_yanCommented:
I have the situation where based on the value of one drop down box (called Submission_type)
I populate next dropdionw boox called bands_number either with one option "N/A"
or with choices "1","2","3"

This is how it works for me with JavaScript both in IE and Firefox:


<script>
function init(){
if(!document.formName)return;
document.formName.sample_name.focus();
document.formName.submission_type.onchange = changeBand;
}
function changeBand()
{sSelect = eval("document.formName.submission_type");
stringSelect = sSelect.options[sSelect.selectedIndex].text;
if(stringSelect == "ThisType"){
document.formName.bands_number.options.length=0;
document.formName.bands_number.options[0]=new Option("1","1",true,true);
document.formName.bands_number.options[1]=new Option("2","2",false,false);
}
else 
{
document.formName.bands_number.options.length=0;
document.formName.bands_number.options[0]=new Option("N/A","N/A",true,true);
}
return;
}
</script>
<body onLoad="init()" bgcolor="lightyellow">....... html starts here


<form action="actionName" enctype="multipart/form-data" method=post name="formname" id="formName">

<tr><td  height="45"><B><font COLOR="#FF0000">Submission type:</font></b></td> <td> <select name="submission_type">
<option>Select type
<option>This type
<option>That type
</select></td></tr>

<td> <select name="bands_number">
<option>N/A
</select></td></tr>

Open in new window

0
 
hipalAuthor Commented:
I am looking for this thing using xml. :(
0
 
CEHJCommented:
This is perhaps the sort of thing you can do- based on an xsl transform:

http://www.stylusstudio.com/xsllist/200211/post91120.html
0
 
for_yanCommented:

If you have XML file form which you want to take values for
dropdown menus of the web page, then the simplest thing is to write a servlet,
which would parse this XML file and produce the web page with required
dropdowns

If you want that these drop downs could be "active" on the page - in a sense that one slection
should affect the default avlue or the total content of another select box - then
you'll need javaScript to implement that on the web page, unless you want
to reload the page after each selection
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.