html5 - How to pass object in Thymeleaf + Spring flow without values -


from search page, user can click create new button. if user enter p_no in search page, , user click create new, number being carried out create new page. should not pass value. wrong code below.

personentry.html(create page) :

<form id="entry" action="#" th:object="${person}" method="post">     <div id="boxes">         <div class="col-md-1">             <input type="text" class="form-control" id="pno" th:value="${person.p_no}" disabled="disabled" />         </div>     </div> </form> 

controller.java:

@controller  @requestmapping("/searchpersons") public class searchpersoncontroller {            @requestmapping(value = "/createnewbtn", method = requestmethod.post) public modelandview creatnewperson(person person) {       modelandview modelandview = new modelandview();      modelandview.setviewname("personentry");     return modelandview;  } }    

search.html:

<script>      $(document).ready( function() {           createactionurl = function(obj) {              $("#seach").attr("action", obj);          }          createactionurl();          });  </script> <form id="search" action="#" th:object="${person}" method="post"> <div class="col-md-1">     <input type="text" size="2" class="form-control" id="p_no" th:field="*{p_no}"></input> </div> <div class="row" align="right" style="width: 100%">     <input type="submit" value="create new" class="btn btn-primary" id="createnewbtn" th:onclick="'javascript:createactionurl(\'' + @{/searchpersons/createnewbtn} + '\')'"  />   </div>   </form> 

can on issue.

below code worked me

<script>      $(document).ready( function() {           $('#createnewbtn').click(function{                $("#seach").clearform(); // clearform function called clear necessary input values.          })          createactionurl = function(obj) {              $("#seach").attr("action", obj);          }          createactionurl();          });  </script> 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -