Grails: editing and deleting links does not work

I created an additional column and added icons at the end of the list to edit and delete the event.

That's what i

<g:form value="${it.id}">
                            <g:hiddenField name="id" value="${it.id}" />
                            <span class="simple"><g:actionSubmit class="editar" action="edit" value="${message(code: 'default.button.editar.label', default: '&nbsp;&nbsp;&nbsp;')}" /></span>
                            <span class="simple"><g:actionSubmit class="eliminar" action="delete" value="${message(code: 'default.button.eliminar.label', default: '&nbsp;&nbsp;&nbsp;')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Esta seguro que desea Eliminar?')}');" /></span>
                        </g:form>

I wrote The ID is ${it.id}, and he recognizes it and gives me an identification number, so I donโ€™t know where the problem is. Any help would be greatly appreciated. Thank.

Update

So, I realized that the error was in the controller where the changes and deletion are defined

def edit = {
    def entryInstance = Entry.get(params.id)
    if (!entryInstance) {
        flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'entry.label', default: 'Proyecto/Ruta'), params.id])}"
        redirect(action: "list")
    }
    else {
        return [entryInstance: entryInstance]
    }
}

I think, since it says that params.id in get parameters I am not working correctly, what are my other alternatives?

0
source share
1 answer
<g:form id="${it.id}"> 
   <span class="simple">
     <g:actionSubmit class="editar" action="edit" 
                     value="${message(code:'default.button.editar.label', 
                                      default: '&nbsp;&nbsp;&nbsp;')}" />
   </span>
   <span class="simple">
     <g:actionSubmit class="eliminar" action="delete" 
                     value="${message(code: 'default.button.eliminar.label', 
                                      default: '&nbsp;&nbsp;&nbsp;')}" 
                     onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Esta seguro que desea Eliminar?')}');" />
   </span>
 </g:form>

: value = "$ {it.id}" g: id = "{it.id}" ID. , .

, ...

+1

Source: https://habr.com/ru/post/1751272/


All Articles