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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:32:55+00:00 2026-06-13T22:32:55+00:00

I have a similar question on this thread where I have a JavaScript function

  • 0

I have a similar question on this thread where I have a JavaScript function which will trigger the click event of a hidden commandLink. And the hidden command will fire the action in Java Bean. This code is working fine in IE, but not in Firefox. Is there any clue on this issue?

JavaScript

<h:outputScript target="head">
    HTMLElement.prototype.click = function() {
    var evt = this.ownerDocument.createEvent('MouseEvents');
    evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
    this.dispatchEvent(evt);
  }

  function triggerHiddenEvent() {
    alert("triggerHiddenEvent is trigger");
    document.getElementById("theForm:hiddenCommand").click();
  }
</h:outputScript>

XHTML

<h:form id="theForm">
  <h:commandLink id="tri_HiddenEvent" value="Trigger Hidden Event" onclick="triggerHiddenEvent"/>

  <p style="display:none">
    <h:commandLink id="hiddenCommand" styleClass="button" action="#{helloBean.doHiddenCommand}"/>
  </p>
  ...

The Bean

@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {
  public String doHiddenCommand() {
    System.out.println("doHiddenCommand is called");
    return "";
  }
}
  • 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-13T22:32:56+00:00Added an answer on June 13, 2026 at 10:32 pm

    change

    onclick="triggerHiddenEvent"

    into

    onclick="triggerHiddenEvent(); return false;"

    you need to add the return false; snippet in order to stop the page from submitting/reloading…

    h:commadLink Tag:

    This tag generates HTML’s <a href link tag and some JavaScript
    functions which make the link to act as a submit button.
    To prevent page submission, you have to explicitly add simple return false; to
    your onclick function

    Difference Between h:commandButton , h:commandLink and h:outputLink in JSF

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

Sidebar

Related Questions

I have a question which is slightly similar to this question on stackoverflow std::cin.clear()
I have a question similar to this thread : [throwing-exceptions-from-model-view-controller-in-a-zend-framework-application][1] I have a standard
My question is similar to this thread which says to lock the iPhone in
I have a similar question to this one However, I have a less strict
I have checked this similar question, but the suggestions did not solve my problem:
I have a question similar to this: how to manually assign imagefield in Django
Similar to this question: link However I have already mastered that. My problem is
Similar to this question I have a custom subclass of UITableViewCell that has a
I have asked a question similar to this in the past but this is
This is similar to this question, except the code is already written. I have

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.