Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts : Dynamic Select Option

807603Nov 28 2007 — edited Dec 7 2007
I have a select box which gets values dynamically from DB. When the selection of contact1 changes i want to display a email id in a disabled textbox. I use Struts and i have to store the selected values back to a different table.

When i submit the selection the selection box goes to the default value which is the 1st one. I am unable to retain the selected value to selected contact1. I would appreciate any quick help on this.

Below are the code extracts:

<select name="contact1" onChange="selecteid(this.options[this.selectedIndex].value,this.options[this.selectedIndex].text);">

<% contactlistopt = contacts.getcontactlistoptions();
while(j<20)
{
j++;
if(contactlistopt[j][0]== null) {contactlistopt[j][0]=""; break;}

%>
<option value="<%=contactlistopt[j][6]%>"><%=contactlistopt[j][0] %></option>
<% } %>

</select>

function selecteid(val,txt)
{

document.createquote.eid.value = val;
document.createquote.contact.value = txt;
document.createquote.contact1.value = txt;
document.createquote.submit();

}

<html:hidden property="eid"/>
<html:hidden property="contact" />

E-id :<html:text property ="hideid" value="<%=possub.getHideid()%>" disabled="true"/>

In the action class i am setting the value for eid and contact1, but doesnt work.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2008
Added on Nov 28 2007
4 comments
161 views