Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

struts and javascript

Status
Not open for further replies.

jags22

Programmer
Oct 17, 2001
44
US
I am using struts and want to add the functionality of javascript for a select box. If the the status field (can be 'A'ctive or Inactive('D')) changes (at this time the will only get to this page if it is Inactive so going in I know that it is Inactive) whether the multibox, a list of checkbox's, will be disabled or enabled. Here is a sample of the the code, the alerts are hitting where they should be hitting but the field in the checkboxes or not be enabled and disabled. Any ideas would be appreciated.

function newSelection(value) {
alert(value);
if (value == 'A') {
document.forms[0].selectedCheckBoxes.disabled = false;
alert("A hit");
} else {
document.forms[0].selectedCheckBoxes.disabled = true;
alert("D hit");
}
}
<table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td align=&quot;right&quot;>Status:</td>
<td><html:select property=&quot;status&quot; size=&quot;1&quot; onchange=&quot;javascript:newSelection(value)&quot; >
<html:eek:ption value=&quot;A&quot;>Active</html:eek:ption>
<html:eek:ption value=&quot;D&quot;>Inactive</html:eek:ption>
</html:select>
</td>
</tr>
<tr>
<td align=&quot;right&quot;>
<b>Status Date:</b>
</td>
<td>
<bean:write name=&quot;ActivityDetailForm&quot; property=&quot;statusDate&quot; />
</td>
</tr>
</table>

<p>Please select the program(s) that relate to the activity:</p>
<table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;0&quot;>
<logic:iterate name=&quot;programList&quot; id=&quot;program&quot; scope=&quot;session&quot;>
<tr>
<td>
<html:multibox name=&quot;ActivityDetailForm&quot; property=&quot;selectedCheckBoxes&quot; disabled=&quot;true&quot; >
<bean:write name=&quot;program&quot; property=&quot;id&quot; />
</html:multibox>
<bean:write name=&quot;program&quot; property=&quot;description&quot; />
</td>
</tr>
</logic:iterate>
</table>

<br/>
<p align=&quot;center&quot;>
<html:link forward=&quot;adminFunctions_List_Activity&quot; >
<ecs:writeButton src=&quot;cancel&quot; />
</html:link>
<ecs:writeButton src=&quot;save&quot; name=&quot;save&quot; />&nbsp;&nbsp;&nbsp;&nbsp;
</p>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top