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

  • SEARCH
  • Home
  • 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 8442453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:50:46+00:00 2026-06-10T08:50:46+00:00

I have one g:select with an onchange event that fires a remoteFunction that is

  • 0

I have one g:select with an onchange event that fires a remoteFunction that is calling the request method as well, however, the callback JS function isn’t been calling.

This is the g:select:

<g:select id="categories"
          name="categories"
          from="${Category.findAll('from Category where master is null')}"
          noSelection="['':'- Selecione -']" optionKey="id" optionValue="description"
          onchange="${remoteFunction(
                  controller: 'event',
                  action: 'subCategoriesJSON',
                  params:'\'id=\' + escape(this.value)',
                  onSuccess: 'updateSubs(data,textStatus)'
          )}"
/>

The subCategoriesJSON is called as well, but there is no way to remoteFunction calls after that the updateSubs function. My page is rendering the scope of the function correctly on the head tag.

This is the function:

<script type="text/javascript">
    $(document).ready(function() {
        function updateSubs(data, textStatus) {
            alert('call me!!!');
            var subs = eval("(" + e.responseText + ")");

            if (subs) {
                $("span#saida").html(subs);
            }
        }
    });
</script>

Any clue will be very welcome. Thanks a lot!

  • 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-06-10T08:50:48+00:00Added an answer on June 10, 2026 at 8:50 am

    It looks like updateSubs is defined as a local function, which means it isn’t accessible from the global scope. Basically move your updateSubs function out of the $(document).ready() – it doesn’t need to be there really as there is no need for your code to wait until the dom is ready before defining that function.

    That should solve your main problem, however you’ll have to edit your code further as you are trying to access e.responseText when you have no access to a variable named e – this will just trip an error until it is fixed. I’ve commented the problem code for now.

    Anyway, once updateSubs is in the global scope the onSuccess handler should be able to access it.

    <script type="text/javascript">
        function updateSubs(data, textStatus) {
            alert('call me!!!');
            //var subs = eval("(" + e.responseText + ")");
            //if (subs) {
            //    $("span#saida").html(subs);
            //}
        }
        // I'm not sure if you actually need this ready function..?
        $(document).ready(function() {
            // if you define a function in here it will only be accessible 
            // from within the scope of this function.
        });
    </script>
    

    For further information about function scope, have a read about Nested functions and closures.

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

Sidebar

Related Questions

I have written a simple CRUD form which has one select list. However the
i have a time dropdown that shows hour in one select, minutes in another
Lets say that we have a query like this one: SELECT *, (CUSTOM_EXPRESSION) as
I have a select, for which a onchange event is set. The problem is,
I have multiple <select/> tags i would like to synchronize so that when one
I have a select list that is created on a .click event. It looks
I have one scenario where I need to select all files having aliencoders.numeric-digits like
I have one demo application to check select for update query public class Test
i have one form which have some input box and some select box. i
I have a form with two text boxes, one select drop down and one

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.