1

I have a date field in my jsp page where I have used apache trinidad. I have written the following code for that

<tr:inputDate label="Date From"  id="dateFrm" value="#{taskStatus.fromDate}"  >
<f:convertDateTime pattern="dd-MM-yyyy"/>
</tr:inputDate> 
<tr:outputLabel value="DD-MM-YYYY" inlineStyle="color:red; vertical-align:top">
</tr:outputLabel>

Now, the problem that I have is that whenever I enter an invalid date the error message is scattered all over the page and I get an extra calender icon! I want to override the element style for inputDate element.So ,that it does not show any error message(or the extra calender icon). I tried to use this to override element style

 <tr:inputDate label="Date From"  id="dateFrm" value="#{taskStatus.fromDate}" inlineStyle="display: inline !important" >

But it did not work either

sovan
  • 363
  • 1
  • 4
  • 13

1 Answers1

0

I never have problems with the layout of error messages. I always put my input fields in tr:panelFormLayout tags, which could result in a more consistent layout for you.

Also I would suggest to use a help facet to show the date format. You can skin it using the selector .OraInlineInfoText.

<tr:panelFormLayout>
  <tr:inputDate label="Date From"
                id="dateFrm"
                value="#{taskStatus.fromDate}">
    <f:convertDateTime pattern="dd-MM-yyyy"/>
    <f:facet name="help">
      <tr:outputText value="DD-MM-YYYY"/>
    </f:facet>
  </tr:inputDate>
</tr:panelFormLayout>
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • that does not hide the extra calender icon that pops up every time I type some erronous value in the date box.I tired using tr:convertDateTime pattern="dd-MM-yyyy" messageDetailConvertDate="Invalid Date" .but it is still showing the default error message – sovan Mar 14 '14 at 14:04
  • If you want to override the default message, please have a look at this post http://stackoverflow.com/questions/15073655/jspx-trinidad-messagedetailnotinrange-for-validatedatetimerange-not-working – Jasper de Vries Mar 14 '14 at 15:49
  • thanks for the coments.I am not using Maven in my project , so I placed the properties file inside package com.resources, then in I added this in properties file org.apache.myfaces.trinidad.convert.DateTimeConverter.CONVERT_DATE_detail=Invalid Date and made an entry in faces-config.xml.This did not work either.How can I define properties file without maven? – sovan Mar 14 '14 at 16:24
  • Just put `messages.properties` in `WEB-INF/classes`. – Jasper de Vries Mar 17 '14 at 08:14