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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:24:33+00:00 2026-05-29T05:24:33+00:00

So I’m diving into Grails for the first time and am trying to accomplish

  • 0

So I’m diving into Grails for the first time and am trying to accomplish what I think would be an easy task, so I hope this is trivial. Time spent on it is making me feel otherwise 🙂

So I have a list of Contacts in a database that are tied to a boolean called isActive. I want to have a check box in my list gsp that determines whether to show inactive members or not.

I’ve tried using a Javascript function (which I could successfully call, but wasn’t sure how to handle the passing after the call). I’ve also tried to add a g:if to check to see if the box’s checked property was enabled, but this results in a null object (which I suspected would happen).

I’ve also tried attaching a remoteFunction call on the onclick of the checkbox, but I never get a response back unfortunately.

Any advice? Thanks – I appreciate it. The challenges of teaching yourself a web language for the first time 🙂

<html>
    <head>
            <meta name="layout" content="main">
        <g:set var="entityName" value="${message(code: 'contact.label', default: 'Contact')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>

    <g:javascript>
        function updateThisPage()
        {

        }
    </g:javascript>

</head>
<body>
    <a href="#list-contact" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
    <div class="nav" role="navigation">
        <ul>
            <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
            <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
            <li><g:checkBox name="showInactives" value="${false}" onclick="....." /></li>
        </ul>
    </div>
    <div id="list-contact" class="content scaffold-list" role="main">
        <h1><g:message code="default.list.label" args="[entityName]" /></h1>
        <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
        </g:if>
        <table>
            <thead>
                <tr>
                <g:if test="${isActive?.checked}">
                    <g:sortableColumn property="firstName" title="${message(code: 'contact.firstName.label', default: 'First Name')}" />

                    <g:sortableColumn property="lastName" title="${message(code: 'contact.lastName.label', default: 'Last Name')}" />

                    <g:sortableColumn property="phone" title="${message(code: 'contact.phone.label', default: 'Phone')}" />

                    <g:sortableColumn property="email" title="${message(code: 'contact.email.label', default: 'Email')}" />

                    <g:sortableColumn property="title" title="${message(code: 'contact.title.label', default: 'Title')}" />

                    <g:sortableColumn property="jobFunc" title="${message(code: 'contact.jobFunc.label', default: 'Job Func')}" />
                </g:if>
                </tr>
            </thead>
            <tbody>
            <g:each in="${contactInstanceList}" status="i" var="contactInstance">
                            <g:if test="${contactInstance.isActive}">
                                <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

                                    <td><g:link action="show" id="${contactInstance.id}">${fieldValue(bean: contactInstance, field: "firstName")}</g:link></td>

                                    <td>${fieldValue(bean: contactInstance, field: "lastName")}</td>

                                    <td>${fieldValue(bean: contactInstance, field: "phone")}</td>

                                    <td>${fieldValue(bean: contactInstance, field: "email")}</td>

                                    <td>${fieldValue(bean: contactInstance, field: "title")}</td>

                                    <td>${fieldValue(bean: contactInstance, field: "jobFunc")}</td>

                                </tr>
                            </g:if>
            </g:each>
            </tbody>
        </table>
        <div class="pagination">
            <g:paginate total="${contactInstanceTotal}" />
        </div>
    </div>
</body>

  • 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-29T05:24:34+00:00Added an answer on May 29, 2026 at 5:24 am

    Why don’t you try JQuery & CSS combination? For example, with every field you have, add a class “Active” or “Inactive” according to their record in Database. Then when you click the button, simply add the class “Hidden” for all the elements that have “Inactive” class.

    jQuery("#hideInactiveContact").click(function(){
       jQuery(".Inactive").addClass("Hidden");
    });
    
    jQuery("#showInactiveContact").click(function(){
       jQuery(".Inactive").removeClass("Hidden");
    });
    

    In CSS, you can do the following and all the elements of “Hidden” class will be hid:

    .Hidden {
    display: none;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.