javascript - How do I display the selected value of the drop down list on gsp -


how display selected value of drop down list on gsp?

<g:select id="plantselect" name="plant" from="${plantlist.list()}"  value="${plant.id}" /> 

can't ${plant} display selected value on view?

you can use following code in order display drop down value:

<html>  <head>   <meta http-equiv="content-type" content="text/html; charset=utf-8">   <title>sample title</title>   <script>   function getvalue(value)   {     alert(value);     document.getelementbyid("test").style.display = "inline";     document.getelementbyid("test").innerhtml  = value;     // $("#test").html(value);    }  </script>  </head>  <body>   <h1>sample line</h1>   <g:select id="plantselect"         name="plant" from="${plantlist.list()}"          optionkey="id" optionvalue="id" onchange="getvalue(this.value)"/>  <!-- if want other field id change id field.-->   <br/>    <div id="test" style="display: none">   </div>  </body>  </html> 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -