Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting a default item in a dynamic dropdown list

 
Vijaya Parvathaneni
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a requirement to set a default item in the dropdown based on some conditions.

I have the value to be set as default in
document.getElementById('defaultBenLevel');

I have my select as below
<form:select path="selBenefitLevel" id="selBenefitLevel" cssClass="selectOneListBox" tabindex="1">
<formptions items="${viBenefitsForm.benefitLevelLst}" itemValue="label" itemLabel="value" />
</form:select>

In my javascript, I am trying to do this

var defaultBenLevel = document.getElementById('defaultBenLevel').value;
document.getElementById('selBenefitLevel').value = defaultBenLevel;

But still I am not able to set the default value as selected. Please help..

Thanks in advance... any help would be highly appreciable..
 
Karthik Jayachandran
Ranch Hand
Posts: 91
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to set value to a combo box from another combo box? This link might help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic