I have several dropdowns displaying the same list of values. These values are not hardcoded but populated from a table. The table also has a column which indicates the maximum number of times the values can be selected. IF the user tries to select the values more than the nbr of times indicated in the table there should be message prompted saying "MAXIMUM REACHED!" and defaulted back to it original selected value(NewYork can be selected as many times as possible as the assigns allowed value is 0 - no restrictions for '0' values). I have also sent a section of code from my JSP which is supposed to call this javascript with Onchange event. I need help writing the Javascript. Please advise as I am a newbie to Javascript. Thanks a bunch.
Table Columns:
EAT Id EAT Name Assigns Allowed
Values:
EAT1 Florida 2
EAT2 Texas 1
EAT3 NewYork 0
JsP:
<SELECT name="exportType" onchange="assignPrompt()">
<OPTION value="NS"><%= eatList .getDefaultName()%>
<%
ExportAssetTypeList eatList = (ExportAssetTypeList) session.getAttribute("ExportAssetTypeList"
;
for(int j = 0 ; j < eatList.size(); j ++)
{
%>
<OPTION value="<%=eat.getId()%>"><%=eat.getName() + " (" + eat.getNumAssignsAllowed() +"
"%>
<%
}
%>
</SELECT>
Table Columns:
EAT Id EAT Name Assigns Allowed
Values:
EAT1 Florida 2
EAT2 Texas 1
EAT3 NewYork 0
JsP:
<SELECT name="exportType" onchange="assignPrompt()">
<OPTION value="NS"><%= eatList .getDefaultName()%>
<%
ExportAssetTypeList eatList = (ExportAssetTypeList) session.getAttribute("ExportAssetTypeList"
for(int j = 0 ; j < eatList.size(); j ++)
{
%>
<OPTION value="<%=eat.getId()%>"><%=eat.getName() + " (" + eat.getNumAssignsAllowed() +"
<%
}
%>
</SELECT>