How can I display an icon, instead of text string, as a validation prompt?

My validate method inside my custom validator is like this:
public void validate(FacesContext context, UIComponent component, Object value) {
  Pattern datePattern = Pattern.compile("(\\d{2})/(\\d{2})/(\\d{4})");
  Matcher dateMatcher = datePattern.matcher((String)value);
  if(!dateMatcher.find()){
    ((UIInput)component).setValid(false);
    FacesMessage message = new FacesMessage();
    String msg = "[" + value + "] invalid date";
    message.setDetail(msg);
    context.addMessage(component.getClientId(context), message);
    FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_FATAL, "xx", "msg");
    throw new ValidatorException(facesMsg);
}My JSP has this:
<h:inputText id="test" value="#{projecthandler.test}">
<f:validator validatorId="DateValidator" />
</h:inputText>
<h:message id="testErrorMessage" for="test"/>The <h:message> tag will kick in if the user has invalid data in the <h:inputText> field and clicks submit.
When the page is regenerated, the user will see a text string reflecting what the issue is.
However, instead of this, I would like to display an icon consisting of a red circle with an exclamation point.
The user is supposed to click on the icon if they want more information. By clicking on the icon,
the user will see a message box, with a description of the error.
This is our standard for applications. I'm trying to put together a demo showing how an existing application
would work in JSF, so I won't be able to talk others into using JSF, unless I can get the validation to display an
icon instead of text.
Edited by: Kazan on Mar 18, 2009 9:31 AM
Edited by: Kazan on Mar 18, 2009 9:33 AM
Edited by: Kazan on Mar 18, 2009 9:36 AM

OK, I noticed a bug in my validate method. This is updated to fix the bug, and to include the recomendation about background-image:
  public void validate(FacesContext context, UIComponent component, Object value) {
    System.out.println("DateValidator.test.1");
    Pattern datePattern = Pattern.compile("(\\d{2})/(\\d{2})/(\\d{4})");
    Matcher dateMatcher = datePattern.matcher((String)value);
    System.out.println("DateValidator.test.1");
    if(!dateMatcher.find()){
      ((UIInput)component).setValid(false);
      FacesMessage message = new FacesMessage();
      String msg = "<span style='background-image: url(/error.gif)'/>";
      message.setDetail(msg);
      message.setSeverity(FacesMessage.SEVERITY_FATAL);
      context.addMessage(component.getClientId(context), message);
      throw new ValidatorException(message);
  }When I run this, the litteral string of "<span style='background-image: url(/error.gif)'/>" is printed as the message. It does not interpret this as a span tag with an image url.
Can someone tell me what's going on?

Similar Messages

  • How can  i  display the Number  instead of  E

    Hello Everyone ;
    I am getting confused. How can i display the Number but the Exponential value is coming as E.
    SQL> select sum(amount_sold) from sales;
    SUM(AMOUNT_SOLD)
    1.1287E+11
    Table details ..
    SQL> desc sales
    Name                                          Null?        Type
    AMOUNT_SOLD NUMBER
    i want to change 1.1287E+11 to "numeric"
    DB : 10.2.0.4
    os : rhel 5.1

    Just a minor correction on an obvious math/responding too fast error: 1.1287E+11 is a 12 digit number. You move the decimal 11 positions to the right which would add 7 zeroes to the value.
    MPOWEL01> l
      1  select length(to_char(1.1287E+11)), to_char(1.1287E+11,'999,999,999,999'), 1.1287E+11 "TEST"
      2* from sys.dual
    MPOWEL01> col TEST format 999999999999
    MPOWEL01> /
    LENGTH(TO_CHAR(1.1287E+11)) TO_CHAR(1.1287E+          TEST
                             12  112,870,000,000  112870000000the problem was that the OP failed to alias the sum result to the formatted column rather than the lenght of the data.
    HTH -- Mark D Powell --

  • How can I display my bookmarks toolbar with text only, but still have the rest of my toolbars (search, navigation, tabs, etc) display icons?

    I have a bunch of bookmarks in my bookmarks toolbar. How can I make my bookmarks toolbar display only text but have my other toolbars (navigation, etc.) display only icons? It seems like I have to choose between icon, icon and text, or text for all of the toolbars. I want it to look like it did with my old version of Firefox. All my bookmarks in the toolbar fit, but now they dont because I cant get rid of the icons.

    You can do that with the Bookmarks Deiconizer extension - https://addons.mozilla.org/firefox/addon/bookmarks-deiconizer

  • Display custom Icons instead of text link

    Hi,
         I have added rating, feedback links in the command List of searchresourcerenderer which will display the link in each documents like this "<u>Rate this document</u> | <u>Feedback</u> | <u>see Also</u> | <u>Details</u>" , will it be possible to show icon link instead of this text link?
    Thanks,
    Vijay

    Hello Vijay,
    As per current functionality. This is not possible here.
    The option if you use your own icons instead of SAP provided for example in case of PPT, DOC etc. The following steps can be used:
    1) Go to System administration/system configuration/KM/CM/Utilities/Icons
    Create a new icon with a mime type
    2)Go to System administration/system configuration/KM/CM/Utilities/Mime Types
    Create a mime type with an extension and use the same mime type of your icon
    Regards
    Anjali

  • When I drag and drop an icon from the address bar to the desktop is does creat the shortcut but will not display the website icon, only the firefox icon, how can I display website icons?

    When I drag and drop a website icon from the Forefox address bar to the desk top, the short cut is created but the icon that appears is the firefox Icon. I want to disply the icon from the website that the short cut refers to. I have checked all I can think of in my computer to no avail.

    You have to assign the favicon yourself to the desktop shortcut (right-click the shortcut: Properties) after you have dragged the link to the desktop.
    You can usually find the favicon in Tools >Page Info > Media and save the icon there.
    Otherwise use the main domain of the website and add favicon.ico (e.g. mozilla.com/favicon.ico ) to display the favicon in a tab and save that image to a folder.

  • How can I display sort icons of an af:table column permanently

    Hello all,
    I'm using JDEV 11.1.1.5. Is there a way using skinning or any other mean to make the sort icons of a column in a af:table to be displayed permanently and not only after a mouse over on the column title?

    Can you try with skinning?
    Check the forum post:
    Column Sort image display permanent
    Thanks,
    Navaneeth

  • Acrobat 8 (simply PROBLEMS) - How can I set an ICON within a BUTTON

    Background: I want to use the basic BUTTON and add some JavaScrpt-code...so I need the CLICK event to start
    Problem: The bad layout properties of the BUTTON - I would like to have an ICON with BUTTON charateristic -> How can I implement an ICON instead the normal Features of Title and Backgroundcolors?

    I work with the LiveCycle Designer (vs. 8 ) to create my Forms -> to solve my problem, I can choose between the fieldtypes: Button, Image, Imagefield, ..., textfield but I haven´t found the right one with is scalable enough. Can you explain me - what you mean with "Acrobat Acro Forms fields" and how can I solve my Problem? Thanks

  • My home page only displays computers and settings icons. No other icon. How can I get other icons?

    My home page only displays computers and settings icons. No other icon. How can I get other icons?

    Looks like a sudden error being thrown up on many ATV2 units.  Yesterday, mine was fine and today I now only have 2 icons like so many other posters.
    No amounts of restarts or restores, disconnecting and reconnecting power, restarting routers, re-logging in to iTunes has any effect at all.

  • In a FM 11 book, how can I display filename w/o file location?

    In a FrameMaker book, how can I display filename without the file's  location on the hard drive?
    For example, The book would list:
    "MyFile.fm"
    instead of
    C:\windows\documents\Framefiles\XYZ Company\widgets\draft_2013_1111\MyFile.fm
    If this cannot be done, then how can I get the book to list a name for the added file other than the name of the first heading in the file contents?

    Check out the little toggle icon beside the magnifying glass in the book tab – you can swap back and forth between “Display Heading Text” and “Display File Names”

  • How can I display more than one value in Calendar ?

    Hi,
    the standard (example) script allows for the display of one value only (as I understood). How can I display two or three values, from the very same table ? Students of mine during an HTMLDB workshop in Leipzig did ask that question.
    Do we have a more detailed docum. on the use of the calendar ?
    pls kindly advise. TIA.
    Bernhard

    my solution:
    Source fo the calendar starts:
    snip>
    declare
    q varchar(32767) := null;
    begin
    q := 'select "ETA", <--- Date Field and concatination of fields as follows:
    "SCHIFFSNAME"|| "ETA_TIME"|| "TERMINAL"||''(br*)'',
    null,
    null,
    null,
    null
    from "#OWNER#"."SCHEDULE"'; . . . . . . .
    snip>
    comment on (br*) - you have to use "<" and ">" instead of "( " and ")" to have the "break/new line effect"
    brgds
    Bernhard

  • How can I display the data in table in separate column?

    I have a vi reading data one by one in the same column.
    How can I display the data with separate column?
    like this:
    data 1 | read | read
    data 2 | read | read
    data 3 | read | read
    (would you mind if I will ask for an example
    because it is much easier for me to work
    with an example)
    THANK YOU.

    If you're reading your data in as a 1D array, this is as simple as using the Reshape Array to make a 2D array. I've attached an example in LabVIEW 6.1 format. The example rearranges a single column of data fill several columns horizontally, but you can easily modify this code to fill the columns downward instead.
    Attachments:
    Data_Column_Example.vi ‏18 KB

  • How can i display the error count

    Hi I'm using jdev11g
    How can i display the count of errors in validation error message pop up instead of displaying the entire list.

    Searching the forum would help
    Re: How to customize Error?

  • Accidentally deleted an App Store app.  how can I get the icon back on my home screen?  when I search for it in the App Store it comes up 'open'. thanks.

    accidently deleted an app Store app.  how can I get the icon back on my home screen?  in the app store it comes up 'open' instead of install.

    What happens if you tap on open?
    Remember, if you ever want to find an app quickly, you can slide all the way to the left (iOS 6 and lower) or pull down (iOS 7 and later) to get to an app.
    If you know for certain that you have deleated the app, please try restarting your phone. There are many ways to do this, but the safest way would be to hold down the power button and then slide to power down.
    Once powered down, restart and try to find the icon on your screen. If you still can't find it, go into the App Store and then find the app you were trying to access. It should have an iCloud download symbol since you've purchased it before, rather than saying "install."

  • How can i get the Icons in the output of ALV?

    Hi,
    I am trying to get the Icons in my report output using ALVs.
    i am adding the following line
       line_fieldcat-icon = 'ICON_GREEN_LIGHT'. in my field catalog for getting the respective Icon in the list. but the Icon is not getting displayed?
    May i know whether the above specified line is correct or not? if not, how can i get the Icons in my output using ALVs?
    Thanks and regards,
    Ramesh.

    Hi,
    take idea from this code :
    INCLUDE ICONs.
    WRITE : / icon_green_light AS ICON.
    WRITE : / icon_red_light AS ICON.
    write : / icon_yellow_light AS ICON.
    OR
    add code as per steps below in your ALV report :
    <b>FIRST :</b>
    INCLUDE ICONs.
    <b>Second :</b> in your internal table add : 
    icon type icon-id,
    <b>Third :</b>
    add this value in icon field for green light.
    itab-icon =  '@08@'.
    append itab.
    <b>Fourth :</b> display
    is_fieldcat-tabname     = 'IT_FINAL'.
    is_fieldcat-fieldname   = 'ICON'.
    is_fieldcat-col_pos     = '1'.
    is_fieldcat-outputlen   = '12'.
    is_fieldcat-seltext_l   = 'ICON'.
    APPEND is_fieldcat TO it_fieldcat.
    CLEAR is_fieldcat.
    Reward points, if helpful,
    Sandeep Kaushik
    Message was edited by:
            Sandeep Kaushik
    null

  • How can we display

    Hello,
    How can we display numbers in this form like 01, 03 or 09 etc...using Math.random method or any other ways.
    thank u

    The-Sue,
    thanks for the reply. What i meant was like for example in this example:
    int)(99*Math.random())+1
    I want that numbers frm 1-9 be displayed as 01, 02, ...09, the rest normal,
    so basically instead showing lets say 6 it should display 06, but if number is 45 it should display like 45 and not 045
    I hope it is more clear now
    thanks

Maybe you are looking for

  • Printer says it needs to connect to update HP instant ink status

    My HP 8610 just started complaining that it needs to connect to update HP instant ink status.  When I try to have it connect, it says there is no internet connection. However, I have solid connection light, I can get the network info from the printer

  • Deleting a file does NOT move it to Trash

    Recently my hard drive failed on my iMac, and it was replaced and the data salvaged.  However, now, when I delete a file, a window opens telling me if I proceed, the file will be permanently deleted.  That is, it no longer is placed in the Trash, whe

  • 5800 ExpressMusic wifi not working

    I just took over a 5800 ExpressMusic from a friend. I want to be able to use the internet with a wifi connection. I am currently in offline mode. I connected to the router in my house. It prompted me with "Create WLAN connection in offline mode?" and

  • Changing footage from 25MBPS to 50MBPS sequence.

    Hello, I have a sequence settings question. I have an mixed-media video on a DV-NTSC timeline (25MBPS). I am outputting to BETA and was told to make a standalone QT movie at DVCPRO50 compression (meaning, at 50MGPS). I have footage that was shot at 2

  • JQuery $(document).ready

    Hi, I was wondering is there something in Spry that equals what is $(document).ready in jQuery? This is called when the DOM is ready but page images might still be loading and this would be called before window.onload... Thanks