0
I have a form on a gsp page and this form has a g:textField that the user will enter values and then click on a button to filter the grid values.
For example: there are 3 registers on the grid... Joaozinho, Jose, Maria. Se o usuário digitar Joaozinho e clique em enviar, deverá aparece apenas os resultados equivalente a Joaozinho.
My form is falling into the controller, but it’s not working. I am using namedQuery in the Domain class and I believe I am passing parameters incorrectly.
Code of my form:
<g:form url="[action:'searchByFilter']" method="GET">
<p>Filtro de busca</p>
<g:textField name="search" params="[search : search]"/>
<g:submitButton name="search" class="input-search"
value="${message(code: 'default.button.search.filter')}" />
</g:form>
Code of my Domain class:
static namedQueries = {
getInvoicesByFilter {
eq 'description', 'search'
}
}
The search attribute refers to the value that was entered in the form input.
Controller code:
def searchByFilter(Invoice invoiceInstance){
respond Invoice.getInvoicesByFilter.list(params), view: "index"
}
When I click on the search button of the form, is not returning any value, but should bring, because I have the registration in the bank.
What should I do to fix this problem?