views:

47

answers:

1

Hi,

I created an extra column and added icons at the end of the list for editing and deleting an event.

Here is what I have

<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 it recognizes it and gives me the ID number, so I don't know where the problem is. Any help would be highly appreciated. Thanks.

Update

So I figured the mistake was in the controller where edit and delete 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 params.id in the get parameters I not working right, what other alternatives do I have??

+1  A: 
<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>

In summary: replace the value="${it.id}" in your g:form tag with id="{it.id}" and remove the hiddenField for ID. I think that will correct the problem.

Let me know if it doesn't work...

proflux
Perfect my friend!Thank you!
fgualda87
Now I am missing one last thing, that it loads the automatic filter when the page first opens. I will post a new question and some more code tomorrow morning. you've been of great help I really appreciate it!
fgualda87
Here is the link to the new question.http://stackoverflow.com/questions/3150155/grails-how-do-i-make-my-page-load-a-filter-when-the-page-loads
fgualda87