Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3220364
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:45:10+00:00 2026-05-17T15:45:10+00:00

I have the create inside the table/list that Grails provides. Here is a pictures

  • 0

I have the create inside the table/list that Grails provides.

Here is a pictures of what I have

As you can see, I create everything on the first row of my table, and then from the 2nd row and on is the actual list.

In the last column of the 2nd row, you can see I have the UPDATE button and a delete button.

The delete button seems to be working fine, but I am having problems with the UPDATE button.

Here is the code for that last column

<g:form>
    <g:hiddenField name="id" value="${densityInstance?.id}" />
    <g:actionSubmit class="editar" action="update" value="${message(code: 'default.button.editar.label', default: '&nbsp;&nbsp;&nbsp;')}" />
    <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: 'Are you sure you want to delete?')}');" />
</g:form>

And here is what I have for the delete and update in the controller

def delete = {
    def densityInstance = Density.get(params.id)
    if (densityInstance) {
        try {
            densityInstance.delete(flush: true)
            flash.message = "${message(code: 'default.deleted.message', args: [message(code: 'density.label', default: 'Density'), params.id])}"
            redirect(action: "list")
        }
        catch (org.springframework.dao.DataIntegrityViolationException e) {
            flash.message = "${message(code: 'default.not.deleted.message', args: [message(code: 'density.label', default: 'Density'), params.id])}"
            redirect(action: "show", id: params.id)
        }
    }
    else {
        flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'density.label', default: 'Density'), params.id])}"
        redirect(action: "list")
    }
}

The DELETE seems to be working fine, and here is the UPDATE, (maybe is the SAVE def that I need to edit, I’m not so sure and that’s why I’m asking.

Here is the UPDATE:

def update = {
    def densityInstance = Density.get(params.id)
    if (densityInstance) {
        if (params.version) {
            def version = params.version.toLong()
            if (densityInstance.version > version) {

                densityInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'density.label', default: 'Density')] as Object[], "Another user has updated this Density while you were editing")
                render(view: "list", model: [densityInstance: densityInstance])
                return
            }
        }
        densityInstance.properties = params
        if (!densityInstance.hasErrors() && densityInstance.save(flush: true)) {
            flash.message = "${message(code: 'default.updated.message', args: [message(code: 'density.label', default: 'Density'), densityInstance.id])}"
            redirect(action: "list", id: densityInstance.id)
        }
        else {
            render(view: "list", model: [densityInstance: densityInstance])
        }
    }
    else {
        flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'density.label', default: 'Density'), params.id])}"
        redirect(action: "list")
    }
}

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:45:11+00:00Added an answer on May 17, 2026 at 3:45 pm

    The g:form you have is only on the final table column, with one hidden form parameter, the id. Delete works, since all it needs is an id. The update requires the rest of the form entries. The editable fields each have a form entry, but they are not enclosed in that g:form, so their data isn’t submitted with the form.

    You need to make the g:form enclose all the columns of the table row. For example:

    <g:form>
      <tr>
        <td>${densityInstance?.id}<g:hiddenField name="id" value="${densityInstance?.id}" /></td>
        <td><g:textField name="commodity" value="${...}"/></td>
        ...
        <td>
          <g:actionSubmit class="editar" action="update" value="${message(code: 'default.button.editar.label', default: '&nbsp;&nbsp;&nbsp;')}" />
          <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: 'Are you sure you want to delete?')}');" />
        </td>
      </tr>
    </g:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small form inside a table. POSTing that form creates a new
I have created a PHP-script to update a web server that is live inside
I want to run javascript/Python/Ruby inside my application. I have an application that creates
I have to create a site definition for a client that must contain pre-defined
I am importing massive amounts of data from Excel that have various table layouts.
This is what I currently have: CREATE OR REPLACE TRIGGER MYTRIGGER AFTER INSERT ON
I have to create a dialog based application, instead of old CFormView type of
I have to create the sin function from scratch in my Comp Sci class,
i have to create an asp.net page dynamically on runtime. It should work like
Is it possible to create/have a non-modal .net OpenFileDialog I have a UI element

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.