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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:25:43+00:00 2026-05-17T02:25:43+00:00

I have a requirement where users should be able to navigate from the first

  • 0

I have a requirement where users should be able to navigate from the first to the last item in a rich:suggestionBox’s list by pressing the key, and vice versa by pressing the .

I need to get this working on richfaces 3.3.x

The quest to get this done has led me to the javascript that is behind the rich:suggestionBox. You can find it at JBoss anon svn. The methods in question are markPrevious() and markNext().

This is how they are defined on the Suggestion.Base.prototype :

markPrevious: function() {
    if (this.index > 0) this.index--;
    //else this.index = this.entryCount - 1;
},

markNext: function() {
    if (this.index < this.entryCount - 1) this.index++;
    //else this.index = 0;
},

As you can see, the functionality that I need is there, but for some reason they placed it in comment. So I tried to override the methods by placing the following bit of javascript in my template file that is used by all my pages:

<script type="text/javascript">
    //<![CDATA[

    if(Suggestion) {
        function newMarkPrevious() {
            if (this.index > 0) this.index--;
            else this.index = this.entryCount - 1;
        }

        function newMarkNext() {
            if (this.index < this.entryCount - 1) this.index++;
            else this.index = 0;
        }

        Suggestion.Base.prototype.markPrevious = newMarkPrevious;
        Suggestion.Base.prototype.markNext = newMarkNext;
      }
    //]]>
    </script>

Now, if I inspect the Suggestion object with firebug, I can see that the methods indeed get overridden. However, all rich:suggestionBoxes on my pages still use the old implementation. So, I’m thinking that somehow, the objects behind the rich:suggestionBoxes get created before I override the prototype. And this is where I’m stuck. I don’t know how I could get my version in there before any of those suggestionBoxes get created.

Has anyone got an idea on how to solve this?

Thanks,

Kim.

P.S. I realise that there is also the option of just adjusting the code directly in the richfaces-ui.jar, but I don’t want to have a custom built jar.

  • 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-17T02:25:44+00:00Added an answer on May 17, 2026 at 2:25 am

    The answer was found by someone over on the richfaces community forum: http://community.jboss.org/message/563271

    You should redefine
    RichFaces.Suggestion.prototype’s
    functions like this:

    if(RichFaces && RichFaces.Suggestion)
    {
    RichFaces.Suggestion.prototype.markPrevious
    = newMarkPrevious;
    RichFaces.Suggestion.prototype.markNext
    = newMarkNext; }

    Because RichFaces.Suggetsion.prototype
    extends Suggestion.Base.prorotype’s
    methods before you redifinition.

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

Sidebar

Related Questions

No related questions found

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.