You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Adam Zimowski <zi...@gmail.com> on 2011/03/16 20:19:48 UTC

TAP5-781: single error message for multiple fields

Hi -

I saw Igor filed this already. I kind of need this feature. Is there a
preferred/suggested work-around? Or any idea when and if this gets
resolved?

I really could use what Igor proposes, or even another signature:

form.recordError(Field);

or, if I could pass null for error message under current signature
would be OK too:

form.recordError(Field, null)

but that doesn't work. Essentially what I'm looking for is generating
field level error without a message (only highlight the field in
error).

Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TAP5-781: single error message for multiple fields

Posted by Adam Zimowski <zi...@gmail.com>.
Answering my own question here, just to document...

This grossly simplified dirty hack simulates behavior described in TAP5-781:

<t:form t:id="myForm">
 <t:if test="multiFieldError"><t:error for="pwd1"/></t:if>
 <div><t:label for="pwd1/>: <t:textfield t:id="pwd1"/></div>
 <t:if test="multiFieldError" negate="true"><t:error for="pwd1"/></t:if>
 <div><t:label for="pwd1/>: <t:textfield t:id="pwd1"/></div>
 <t:if test="multiFieldError" negate="true"><t:error for="pwd2"/></t:if>
</t:form>

Then in the Page class:

@Persist("flash")
@Property(write=false)
private boolean multiFieldError;

// inject form & fields

@OnEvent(value="validate", component="myForm")
void onValidate()  {
 // if combination of both fields is an error
 multiFieldError = true;
 .recordError(pwd1, error);
 .recordError(pwd2, error);
}

Adam


On Wed, Mar 16, 2011 at 2:21 PM, Adam Zimowski <zi...@gmail.com> wrote:
> Here is the URL to what Igor opened:
> https://issues.apache.org/jira/browse/TAP5-781
>
> Adam
>
> On Wed, Mar 16, 2011 at 2:19 PM, Adam Zimowski <zi...@gmail.com> wrote:
>> Hi -
>>
>> I saw Igor filed this already. I kind of need this feature. Is there a
>> preferred/suggested work-around? Or any idea when and if this gets
>> resolved?
>>
>> I really could use what Igor proposes, or even another signature:
>>
>> form.recordError(Field);
>>
>> or, if I could pass null for error message under current signature
>> would be OK too:
>>
>> form.recordError(Field, null)
>>
>> but that doesn't work. Essentially what I'm looking for is generating
>> field level error without a message (only highlight the field in
>> error).
>>
>> Adam
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TAP5-781: single error message for multiple fields

Posted by Adam Zimowski <zi...@gmail.com>.
Here is the URL to what Igor opened:
https://issues.apache.org/jira/browse/TAP5-781

Adam

On Wed, Mar 16, 2011 at 2:19 PM, Adam Zimowski <zi...@gmail.com> wrote:
> Hi -
>
> I saw Igor filed this already. I kind of need this feature. Is there a
> preferred/suggested work-around? Or any idea when and if this gets
> resolved?
>
> I really could use what Igor proposes, or even another signature:
>
> form.recordError(Field);
>
> or, if I could pass null for error message under current signature
> would be OK too:
>
> form.recordError(Field, null)
>
> but that doesn't work. Essentially what I'm looking for is generating
> field level error without a message (only highlight the field in
> error).
>
> Adam
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org