You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Max Pimm <ma...@alwayssunny.com> on 2007/07/05 12:49:57 UTC
[S2] Client side validation, hidden fields and clearErrorMessages
not working in firefox
I'm using 2.0.8 and using client side validation which its almost
working perfectly.
Unfortunately the only obstacle is that i can't put hidden fields in my
form. The validation works correctly the problem is that the second time
i validate the same form (without sending it to the server) the initial
error messages are not removed due to a faliure in the functions
I will explain...
When you set validate="true" in your form tag a javascript import to the
file struts/xhtml/validation.js is included in the page. This import
includes the function clearErrorMessages.
The idea is that this function should clear the error messages before
each validation. The way it works is by looking for the first element in
the form, it should be the field table, and then removing all rows which
have the attribute "errorFor".
The problem comes when you put hidden fields in the form. Regardless of
where you put them in the html in firefox they are always moved to the
top of the forms child elements in the dom tree. (This ocurrs in firefox
but not in IE where the function works correctly).
When the clearErrorMessages function finds that the first child of the
form is not a table but an input it returns without clearing the error
messages.
A solution would be to iterate over the form elements until the table is
found rather than expecting it to be the first element.
I think that this is a bug but i've not found anything in JIRA.
max
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Client side validation, hidden fields and clearErrorMessages
not working in firefox
Posted by Max Pimm <ma...@alwayssunny.com>.
I have created an issue in JIRA.
(https://issues.apache.org/struts/browse/WW-2058)
max
Theo Platt wrote:
> Thanks Max, I've just been looking at exactly the same area and I can
> replicate the same error. It works fine in IE but fails in firefox.
>
> I think you should enter it in JIRA.
>
> Cheers
>
> Theo
>
>
> maxmil wrote:
>
>> I'm using 2.0.8 and using client side validation which its almost
>> working perfectly.
>>
>> Unfortunately the only obstacle is that i can't put hidden fields in my
>> form. The validation works correctly the problem is that the second time
>> i validate the same form (without sending it to the server) the initial
>> error messages are not removed due to a faliure in the functions
>>
>> I will explain...
>>
>> When you set validate="true" in your form tag a javascript import to the
>> file struts/xhtml/validation.js is included in the page. This import
>> includes the function clearErrorMessages.
>>
>> The idea is that this function should clear the error messages before
>> each validation. The way it works is by looking for the first element in
>> the form, it should be the field table, and then removing all rows which
>> have the attribute "errorFor".
>>
>> The problem comes when you put hidden fields in the form. Regardless of
>> where you put them in the html in firefox they are always moved to the
>> top of the forms child elements in the dom tree. (This ocurrs in firefox
>> but not in IE where the function works correctly).
>>
>> When the clearErrorMessages function finds that the first child of the
>> form is not a table but an input it returns without clearing the error
>> messages.
>>
>> A solution would be to iterate over the form elements until the table is
>> found rather than expecting it to be the first element.
>>
>> I think that this is a bug but i've not found anything in JIRA.
>>
>> max
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] Client side validation, hidden fields and
clearErrorMessages not working in firefox
Posted by Theo Platt <th...@beausejour.net>.
Thanks Max, I've just been looking at exactly the same area and I can
replicate the same error. It works fine in IE but fails in firefox.
I think you should enter it in JIRA.
Cheers
Theo
maxmil wrote:
>
> I'm using 2.0.8 and using client side validation which its almost
> working perfectly.
>
> Unfortunately the only obstacle is that i can't put hidden fields in my
> form. The validation works correctly the problem is that the second time
> i validate the same form (without sending it to the server) the initial
> error messages are not removed due to a faliure in the functions
>
> I will explain...
>
> When you set validate="true" in your form tag a javascript import to the
> file struts/xhtml/validation.js is included in the page. This import
> includes the function clearErrorMessages.
>
> The idea is that this function should clear the error messages before
> each validation. The way it works is by looking for the first element in
> the form, it should be the field table, and then removing all rows which
> have the attribute "errorFor".
>
> The problem comes when you put hidden fields in the form. Regardless of
> where you put them in the html in firefox they are always moved to the
> top of the forms child elements in the dom tree. (This ocurrs in firefox
> but not in IE where the function works correctly).
>
> When the clearErrorMessages function finds that the first child of the
> form is not a table but an input it returns without clearing the error
> messages.
>
> A solution would be to iterate over the form elements until the table is
> found rather than expecting it to be the first element.
>
> I think that this is a bug but i've not found anything in JIRA.
>
> max
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/-S2--Client-side-validation%2C-hidden-fields-and-clearErrorMessages-not-working-in-firefox-tf4028991.html#a11517491
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org