I have a field Marital status. It is a spring form select(drop down) and the options are being generated dynamically based on the selections in the previous pages.
I am stuck in a particular scenario where the form select will have only one option(Say spouse) in the drop down. If the user selects the only available and selected drop down option(with the intent of changing), I need to show a message that it can't be changed here and it should be changed in previous pages.
I searched a lot but could not find something around form select select or click event in jquery ? The Jquery .on('change'.... ) will not serve my purpose as there is just one value in the dropdown and the change event will not be fired.
Below is the code for rendering the dropdown select and options :-
<!-- Marital Status --> <html:condition name="marital_status" screen="drivers" model="${SESSION_INFO}"> <div class="formrow"> <div class="formlables padding-top-2"> <label><spring:message code="msg.drivers.marital_status" text="Marital Status" /></label> </div> <div class="formhelp padding-top-2"> <html:help enabled="true" model="${SESSION_INFO}" helpMsgKey="msgKeyMaritalStatus" /> </div> <div id="box-marital_status" class="forminput"> <shtml:select id="maritalStatus" items="${ITEMS_MARITAL_STATUS}" path="driverInfo.maritalStatus" cssclass="select fixed_width" style="margin-bottom: 20px; width: 300px;" tabindex="7" />
1