[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

populating dropdowns using xml

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

Thanks
0
hipal
Asked:
hipal
  • 3
  • 2
  • 2
2 Solutions
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now