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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:30:08+00:00 2026-06-08T21:30:08+00:00

So here is my problem. I am trying to take the value that comes

  • 0

So here is my problem. I am trying to take the value that comes from the backend and get rid of unwanted text in the value. So basically I get a color back and there is an asterisk or two at the end of the color name. I send that value to a JavaScript function and remove any asterisks that may be present in the string. This has been working fine for me up until now. I found one other location that this was happening and when I try to do the same thing, it doesn’t work. The string comes in with the asterisks, I remove them and replace the html with the new string and for a brief moment, it works, then the original string comes back.

So, here is a bit more detail. In the app I am working on, there is a link that when clicked opens a richfaces modal window. Then, there is a table that is populated with various quotes that have come in from the website. At the end of each row is a “View” link to view the details of the quote. When that is clicked, it opens another modal that has a table with each product, color, size, and other information they customer wants quoted on. In the “View” link code there is an onclick, this is where I put my function call.

<a4j:commandLink ajaxSingle="true" action="# editRequestedQuoteController.viewRequestedQuote}"
    reRender="mainRequestedQuotePanel,subpanel,btnPanel,messagPanelView"
    onclick="#{rich:component('viewRequestedQuotePanel')}.show(); changeColorName()">
    <span>View</span>
    <f:param name="orderId" value="#{order.id}"/>
</a4j:commandLink>

The changeColorName() function is called and runs the following code:

function changeColorName() {
    jQuery(".managedorder-color-name").each(function(){
        var existingColor = jQuery(this).text();
        var newColor = existingColor.replace(/\*/g, '');
        jQuery(this).text(newColor.trim(newColor));
    });
}

The code newColor.trim(newColor) is just removing leading/trailing spaces from the string.

Here is the code where the string is being rendered:

<c:forEach var="orderItem" items="#{editRequestedQuoteBean.orderItems}" varStatus="status" >
    ...
    <td rowspan="#{orderItem.logo.logoName != null ? '4' : '2'}">
        <h:outputText styleClass="managedorder-color-name" value="#{orderItem.itemColor.swatchcolor}" />
    </td>
    ...
</c:forEach>

When I debug it with FireBug, I can walk through the code and see it execute, so I know it is getting called. However I should point out here that sometimes on the first run through, the code does not seem to execute, but if I click the “veiw” link a second time then it does execute. When I step over the last line, I can see the text is replaced with the string I am sending, but then if I “continue” (F8), the string goes back to the version I started with, the one with the asterisks. Does anyone know why this might be happening? Please, anyone, let me know if this is unclear or if you need more information.

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-06-08T21:30:09+00:00Added an answer on June 8, 2026 at 9:30 pm

    The changes are been overridden by the ajax rendering. The onclick is executed before the ajax request. But when the ajax request completes, then the HTML DOM tree is changed with new elements from the server side. You need to execute the changeColorName() JS function after the ajax rendering. You can use the oncomplete attribute for this.

    <a4j:commandLink ... oncomplete="changeColorName()" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my problem. I am trying to store data from my web app
Im trying to get this program to take the users input and put that
I have a problem here im trying to upload a file first time it
Here is a problem I am trying to solve: I have an irregular shape.
Here's my problem - I'm trying to access a session namespace across actions .
Here's my problem: I'm trying to set up a simple mobile contact form with
I'm trying to solve the problem here but I don't know why my code
I have an interesting problem here I've been trying to solve for the last
I am trying to create a simple drawing game like DrawSomething. The problem here
I am stuck with a small problem here.. What i am trying to do

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.