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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:54:51+00:00 2026-06-09T03:54:51+00:00

I have this simple JSF button: //Question Dialog function deletedialog(button, a){ $(<div />, {

  • 0

I have this simple JSF button:

//Question Dialog
function deletedialog(button, a){      
    $("<div />", {
        text: a
    }).dialog({        
        width: 600,
        buttons: {
            "Ok": function() { 
                $("#form\\:deleterow").click();
                //  $('input[id$="deleterow"]').click();               
                $(this).dialog("close");
                button.value = "Processing...";
                button.disabled = true;                  
            }, 
            "Cancel": function(event) { 
                $(this).dialog("close");
                event.preventDefault();
                button.value = "Delete";
                button.disabled = false;
            } 
        }
    });         
}


                    <!-- hidden button -->
                    <h:commandButton id="deleterow" value="HiddenDelete" action="#{AccountsController.deleteSelectedIDs}" style="display:none">
                        <f:ajax render="@form"></f:ajax>
                    </h:commandButton>
                    <!-- the delete button -->
                    <h:button onclick="deletedialog(this, 'Do you want to delete the selected rows?'); return false;" >
                        <h:graphicImage name="small-hover.png" library="images" title="Delete" />
                    </h:button>    

I want to create png image which will be the visual body of the button. The only thing that I will change will be the title of the button which I will set every time using the value attribute of the button. Is this possible? Now when I load the JSF page I see only empty button without label.

P.S 1 I get this result:

enter image description here

  • 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-09T03:54:52+00:00Added an answer on June 9, 2026 at 3:54 am

    Use a command link that will wrap your image:

    <script type="text/javascript">
        function deletedialog(button, a) {
            $("<div />", {
                text: a
            }).dialog({        
                width: 600,
                buttons: {
                    "Ok": function() { 
                        //$("#form\\:deleterow").click();
                        //using the hidden button click
                        document.getElementById('myForm:deleterow').click();
                        //  $('input[id$="deleterow"]').click();               
                        $(this).dialog("close");
                        button.value = "Processing...";
                        button.disabled = true;                  
                    }, 
                    "Cancel": function(event) { 
                        $(this).dialog("close");
                        event.preventDefault();
                        button.value = "Delete";
                        button.disabled = false;
                    }
                }
            });
        }
    </script>
    
    <h:form id="myForm">
        <h:commandLink onclick="deletedialog(this, 'Do you want to delete the selected rows?')) return false;">
            <h:graphicImage name="small-hover.png" library="images"
                title="#{someBean.imageTitle}" />
        </h:commandLink>
        <h:commandButton id="deleterow" value="HiddenDelete" action="#{AccountsController.deleteSelectedIDs}" style="display:none">
            <f:ajax render="@form" />
        </h:commandButton>
    </h:form>
    

    Also, there is a good example of <h:graphicImage/> in mkyong site.


    Based on your comments, it looks like you want to have a button with an icon. Also, the real action is performed by your hidden <h:commandButton>. so I recommend you to read this answer:

    • HTML / CSS How to add image icon to input type=“button”?

    Your code would be like this:

    <h:commandButton id="deleterow" value="HiddenDelete" action="#{AccountsController.deleteSelectedIDs}" style="display:none">
        <f:ajax render="@form" />
    </h:commandButton>
    <button type="submit" onclick="deletedialog(this, 'Do you want to delete the selected rows?')) return false;"><img src="resources/images/small-hover.png" /> Delete</button>
    

    Yes, you can mix basic HTML with JSF code, but read the link warning about this implementation on IE 6 browser clients.

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

Sidebar

Related Questions

i have this simple question please. I have this part of code which sets
I have this simple form which shows a pop up calendar when clicked on
I have a very simple JSF form: <h:form id=simpleSearch> <h:inputText id=surname value=#{myBean.surname} required=true />
This should be a very simple question. I have a richfaces tree that is
Richfaces 3.3.3, Jsf 1.2: I have a a4j:form that uses some simple validation, mainly
I have this simple piece of code : int a = 1, b =
I have this simple code (for making things shorted, the important bits are probably
I have this simple redirection on my website and it does not rewrite my
I have this simple rule in my Makefile : PP=g++ -std=c++0x %.o: $.cpp $(PP)
i have this simple query : SELECT YEAR(P.DateCreated) ,MONTH(P.DateCreated) ,COUNT(*) AS cnt FROM tbl1,

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.