java - Do not clear form content upon POST -


i using spring form tabs, each tab again has form. problems

1)after form submission, error messages displayed form content cleared should not happen
2)after form submission control goes default tab first tab in case. want control stay on current tab after transaction , not go default tab.

this first time working using spring mvc, jsp, jquery. please let me know if have make changes.

administrator.jsp

below code manage users tab functionality.

jquery:

$(document).ready(function() { $('#btnmanage').click(function() {             if($.trim($('#userid').val()) == ''){                 $('#area5').html("user id required field.");              }else if($.trim($('#region').val()) == 'none'){                 $('#area5').html("region required field.");              }else{             $('#manageuserform').submit();              }         }); $('#btncancel5').click(function(e) {             $('#manageuserform').trigger("reset");             $('#area5').html("");         }); }); 

administrator.jsp:

<div id="tab5" class="tab">         <div class="devices" >         <form:form method="post" id="manageuserform" modelattribute="adminuser" action="/devicemanager/admin/manageuser">         <div align=center class="message" id="area5">${servererror5}</div>          <div>             <div class="pllabelsearch">user id:</div>              <div class="plinput"><form:input path="userid" type="text" size="29"/></div>         </div>         <div>             <div class="pllabelsearch">region:</div>              <div class="plselect">             <form:select path="region">             <form:option value="none" label="------- select 1 -------" />             <form:option value="a" label="a"/>             <form:options items="${regionlist}"/>             </form:select>         </div>         </div>         <br>         <br>         <div>             <div class="pllabelsearch">&nbsp;</div>             <div class="plinput"><a id="btnmanage" class="abutton">ok</a></div>             <div class="plinput"><a id="btncancel5" class="abutton">cancel</a></div>         </div>     </form:form>         </div>     </div>         

you need re-render page data original form submission.

in case means form should contain few hidden fields allow determine tab on, jsp need able understand data , use select appropriate tab.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -