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 3442588
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:41:14+00:00 2026-05-18T08:41:14+00:00

In a GSP (Groovy Server Page), I’m using <g:submitToRemote update=…> to update a <div>

  • 0

In a GSP (Groovy Server Page), I’m using <g:submitToRemote update="..."> to update a <div> after the server-side call.

According to the tag’s documentation and other sources on the web, the target <div> can be placed arbitrarily at the page. In my testings, however, I find that the <div> needs to surround the <g:submitToRemote> tag.

If it does not, the <div> will be updated with some “random” contents (i.e., parts of the form that surround the <g:submitToRemote> tag).

Consider the following GSP code:

<html>
<head>
    <g:javascript library="prototype" />
</head>
<body>

<div id="updateMe_NOT_WORKING">${message}</div>

<g:form>
    <div id="updateMe_WORKING">
        <g:submitToRemote value="Click Me"
            action="someAction" update="updateMe_NOT_WORKING" />
    </div>
</g:form>

</body>
</html>

That’s on Grails 1.3.4.
What am I missing? – Thanks

  • 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-18T08:41:15+00:00Added an answer on May 18, 2026 at 8:41 am

    According to my testings, g:submitToRemote‘s action attribute must not point to the current controller’s current action (as this will insert/duplicate the current view into the current view).

    It works if you specify an alternate action in g:submitToRemote – i.e.,

    <g:submitToRemote value="Click Me"
        action="ajaxAction" update="updateMe" />
    

    If this action provides a model – i.e.,

    def ajaxAction = { [message: 'foo'] }
    

    then there needs to be a corresponding GSP – that, in this case, should state,

    $message
    

    Alternatively, the action can use the render method – like this,

    def ajaxAction = { render 'foo' }
    

    I’ll leave this issue open for some time, in case there might be additional responses, and, if there aren’t, will accept this answer as the solution.

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload an image using a groovy on grails. My gsp page
I'm Using Grails 1.2.1, Groovy 1.7.7. For this line of code in a GSP
In my gsp page, after clicking on an image, i want to save something
I have a page/gsp that displays 3 different classes. This means that I need
I'm trying to build a control logic that depends on the current gsp page
I have problem with encode slash in url. Problem: from request in GSP page:
Russian characters are shown correctly on the page but incorrectly displayed on the server
My grails app will not decode request parameters correctly. In config.groovy: grails.views.gsp.encoding = UTF-8
I have a Groovy application. I am rendering the view list using the following
This works as expected in a GSP-page: <td>${Foo.findAllByBar(bar)}</td> But when adding a collect statement

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.