struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raghuveer" <raghuve...@infotechsw.com>
Subject RE: Marking fields with background colour having errors for nested tags
Date Mon, 08 May 2006 12:49:52 GMT
Niall
Thanks for support
I got by using "<nested:messagesPresent" as below in JSP

<nested:messagesPresent property="customerRef" message="false">
<font color="red">*</font>
</nested:messagesPresent>
<nested:messagesNotPresent property="customerRef" message="false">
*
</nested:messagesNotPresent>

-----Original Message-----
From: Raghuveer [mailto:raghuveerv@infotechsw.com]
Sent: Monday, May 08, 2006 6:13 PM
To: 'Niall Pemberton'; 'Struts Users Mailing List'
Subject: RE: Marking fields with background colour having errors for
nested tags



Niall,

How to pass the iterate indexId value to property of bean in nested tags

Example:

JSP
-----------
arlCollectionOrderRfq[i].customerRef property in <logic:messagesPresent

JAVA
-----------
errors.add("arlCollectionOrderRfq["+(nDataRow-1)+"].customerRef", new
ActionMessage("errors.orderparts.data"));



<nested:iterate  id="crderPartsBO" name="orderPartsActionForm"
property="arlCollectionOrderRfq" type="com.nested.test.OrderPartsBO"
indexId="i" >
<tr>
<td>
<logic:messagesPresent property="arlCollectionOrderRfq[i].customerRef"
message="false">
  <%=i%>=<font color="red">*</font>
</logic:messagesPresent>




-----Original Message-----
From: Niall Pemberton [mailto:niall.pemberton@gmail.com]
Sent: Monday, May 08, 2006 5:27 PM
To: Struts Users Mailing List; raghuveerv@infotechsw.com
Subject: Re: Marking fields with background colour having errors for
nested tags


On 5/8/06, Raghuveer <raghuveerv@infotechsw.com> wrote:
>
> Is it possiable in struts to show a label in different colours.
> I.e Identfying label and showing in different color if the related html
> object is having any errors
>
> In below example i need to show label User Name in red color if there is
any
> data error in
> Nested tag <nested:text  property="userName"

You could use the "messagesPresent" and "messagesNotPresent" tags to
do this, but its a bit cumbersome:

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-logic.html#messag
esPresent
http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-logic.html#messag
esNotPresent

for example...

<logic:messagesPresent property="userName">
  <font color="red>User Name:</font>
</logic:messagesPresent>
<logic:messagesNotPresentproperty="userName">
  User Name:
</logic:messagesNotPresent>

The alternative is to write your own custom label tag that checks for
the presence of error messages in the same ways as these tags and
emits whatever html you want, wrapped around the label text.

Niall

> Example :User Name
>
> <nested:text  property="userName" size="26" maxlength="20"
> styleClass="inputtype"  errorStyle="background-color: red"
> errorStyleClass="inputtypeerror" /></td>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message