javascript - Grails: How to display data from datasource based on selection in GSP form -
javascript - Grails: How to display data from datasource based on selection in GSP form -
i have pulldown menu generated mysql datasource.
<g:select onchange="selected()" id="name" name="name" from="${listofnames()}" noselection="['':'--']"/>
this populates menu 1 column table
now based on selection want display additional columns same table text on gsp form.
so user selects name1 dropdown. display underneath dropdown menu
name1. age 21. grade yes.
i have action within controller called alldetails queries values associate name , returns string. not sure how pass parameters
"${remotefunction(action:'alldetails', params: \'name=\' params.name')}
what best way this. run javascript remote function within selected() or gsp tag calls action somehow? how display returned string? alter innerhtml?
tried http://www.grails.org/ajax-driven+selects+in+gsp
you cannot utilize remotefunction
or other core grails tags, because text generated during page rendering, , know selected name during javascript executing in onchange
.
so utilize jquery ajax call (unless switched different javascript plugin).
and suggest select not name, id
of person, in sec g:select example.
javascript grails gsp
Comments
Post a Comment