<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How can I set an icon from the CMS on a commandButton?</title><link>https://answers.axonivy.com/questions/564/how-can-i-set-an-icon-from-the-cms-on-a-commandbutton</link><description>&lt;p&gt;I want to set an icon from the CMS on a p:commandButton.
How can I achieve this?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/564/how-can-i-set-an-icon-from-the-cms-on-a-commandbutton" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 06 Mar 2014 18:01:15 -0500</lastBuildDate><item><title>Answer by Alexis</title><link>https://answers.axonivy.com/questions/564/how-can-i-set-an-icon-from-the-cms-on-a-commandbutton/566</link><description>&lt;p&gt;Thank you for the answer Peter!
Additionally there is a possibility to get Icons dynamically:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;c:forEach items="#{data.navElems}" var="n"&amp;gt; 
  &amp;lt;p:menuitem value="#{n.description}" icon="#{resource[n.imageUrl]}" /&amp;gt; 
&amp;lt;/c:forEach&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The n.imageUrl is like: 'ivy-cms:/nav1/_image'&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis</dc:creator><pubDate>Thu, 06 Mar 2014 18:01:15 -0500</pubDate><guid>https://answers.axonivy.com/questions/564/how-can-i-set-an-icon-from-the-cms-on-a-commandbutton/566</guid></item><item><title>Answer by Peter Stöckli</title><link>https://answers.axonivy.com/questions/564/how-can-i-set-an-icon-from-the-cms-on-a-commandbutton/565</link><description>&lt;p&gt;You can do this by defining a CSS style:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.ui-icon-my{
    background-image: url("#{resource['ivy-cms:images/myIcon']}") !important;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then use it like this on the commandButton:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p:commandButton actionListener="#{logic.closed}" update="form" value="hallo" image="ui-icon-my" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which will then look like this:
&lt;img alt="alt text" src="/upfiles/Unbenannt.PNG"&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Stöckli</dc:creator><pubDate>Thu, 06 Mar 2014 14:50:36 -0500</pubDate><guid>https://answers.axonivy.com/questions/564/how-can-i-set-an-icon-from-the-cms-on-a-commandbutton/565</guid></item></channel></rss>