It's not a secret anymore!*
The moose likes JSF and the fly likes need help on jsf error message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "need help on jsf error message" Watch "need help on jsf error message" New topic
Author

need help on jsf error message

Adi Wanik
Greenhorn

Joined: Feb 15, 2011
Posts: 7
hi,
i am using jsf+xhtml. there are some input fields, and when i enter some junk characters it shows error message like "please entere valid value".
but i when i enter junk characters into two three fields it shows same error message for all of them..but i want to show that error msgs for each individual input fields...like "please entere valid value for field 1, for field 2 etc.... but when i give rowKeyVar="idx" in the a4j: repeat loop its iterating well giving sequence of input fields as 1, 2, 3..etc..but when i use this same idx to display the error message individually like: <f:attribute name="fieldRef" value="#{idx+1}"/>, its not acxcessing the value of idx here..the code is as follows:
<div class="s83pce_padding5px s83p32_padding-bottom-0">
<table class="s83pce_table-spread s83p32_daymodel-shifttable">
<tr><td>
<t:div id="s83p32_breaks">
<div class="#{(DIALOG.DATA.numberOfBreaks > 3) ? 's83p32_daymodel-breakdiv' : ''}">
<table cellspacing="5" width="96%">
<a4j:repeat id="break" value="#{DIALOG.DATA.dayModel.breaks}" var="key" rowKeyVar="idx" >

<tr>

<td width="60px" valign="middle">

<hutputText value="#{idx+1}." />  //HERE IT IS ITERATING FINE, GIVING 1, 2 ,3 DYNAMICALLY
<hutputText value="#{DIALOG.I18N.BREAK}" />
</td>
<td width="80px" class="s83p32_daymodel-from">
<hutputText value="#{DIALOG.I18N.FROM_TO}:" />
</td>

<td valign="top">
<h:selectOneMenu value="#{key.beginTime.productionDayOffsetForDisplay}">
<f:selectItems value="#{DIALOG.DATA.dayOffsets}" />
<a4j:support event="onchange" reRender="s83p32_break_duration" ajaxSingle="true"/>
</h:selectOneMenu>
</td>

<td valign="top">
<h:inputText value="#{key.beginTime.time}"
styleClass="s83p32_daymodel-begintimetext">
<f:attribute name="replaceMessage" value="#{DIALOG.I18N.BREAKSTART_REQUIRED}" />
<f:attribute name="fieldRef" value="#{idx+1}."/> //BUT WHEN I USE THIS idx HERE, IT IS NOT ITERATING;
INFACT IT IS NOT ACCESSING (OR READING) idx HERE.
// I HAVE SET {fieldRef} in i18n properties file with the error message


<f:converter converterId="CalendarTimeConverter" />
<a4j:support event="onsubmit" reRender="s83p32_break_duration" ajaxSingle="true"/>
</h:inputText>
</td>

<td class="s83p32_daymodel-brk-separator">-</td>
<td valign="top">
<h:selectOneMenu value="#{key.endTime.productionDayOffsetForDisplay}">
<f:selectItems value="#{DIALOG.DATA.dayOffsets}" />
<a4j:support event="onchange" reRender="s83p32_break_duration" ajaxSingle="true"/>
</h:selectOneMenu>
</td>
<td valign="top">
<h:inputText value="#{key.endTime.time}"
styleClass="s83p32_daymodel-begintimetext">
<f:attribute name="replaceMessage" value="#{DIALOG.I18N.BREAKEND_REQUIRED}" />
<f:attribute name="fieldRef" value="#{idx+1}."/> // SAME HERE


<f:converter converterId="CalendarTimeConverter" />
<a4j:support event="onsubmit" reRender="s83p32_break_duration" ajaxSingle="true"/>
</h:inputText>
</td>


please help me
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: need help on jsf error message
 
Similar Threads
problem on saving inputText values
I need help with ajaxSingle, reRender and immediate.
noSuchElementException when using SelectoneMenu
Value of "idx" is not printing in the tag <f:attribute name="fieldRef" value="#{idx}"/>
File browser button