Add id to g form form in Grails

The id item in the <g:form> tag does not support this function. If you need to add an id item to the generated form, you can use the name item, which will generate two elements with the same name and id in the generated page.

<g:form controller="game" action="list" name="gameForm">  
  <label for="name">Username</label>  
  <input type="text" name="name" id="name"/>  
  <label for="psw">Username</label>  
  <input type="password" name="psw" id="psw"/>  
</g:form>
<form action="game/list" id="gameForm" name="gameForm">  
  <label for="name">Username</label>  
  <input type="text" name="name" id="name"/>  
  <label for="psw">Username</label>  
  <input type="password" name="psw" id="psw"/>  
</form>  


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325796401&siteId=291194637