struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Error message's is not XHTML valid
Date Thu, 13 Mar 2014 06:49:49 GMT
All these errorFor's are used to identify tags which present error
messages and allow to delete them using JS. I'm not sure but maybe
XHTML allows custom attributes, if not we can use id with prefix, ie:
<tr id="error-for-....."


JS snippet
// clear out any rows with an "errorFor" attribute
    // clear out any rows with an "errorFor" attribute
    var rows = table.rows;
    if (rows === null){
        return;
    }

    var rowsToDelete = [];
    for(i = 0; i < rows.length; i++) {
        r = rows[i];
        // allow blank errorFor values on dojo markup
        if (r.getAttribute("errorFor") !== null) {
            rowsToDelete.push(r);
        }
    }

    // now delete the rows
    for (i = 0; i < rowsToDelete.length; i++) {
        r = rowsToDelete[i];
        table.deleteRow(r.rowIndex);
        //table.removeChild(rowsToDelete[i]);
    }


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2014-03-10 19:49 GMT+01:00 Fredrik Andersson <fredand44@hotmail.com>:
> Hello guys!
>
> I might need to bother you about this presumptive bug also.
> Since you know I'm trying to produce a app that renders in XHTML.
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> (I use struts 2.3.15.3)
> I got struts-user-input-validations in a form.
> For eg one field is a email-address-field and must be filled in by the user.
> So if I submit this form without any email-address there will be an error message.
> I would like that that page would consist of valid xhtml as. A snippet from this page
with the error message looks like:
>
> 25 <form id="productcommentssave" name="productcommentssave" action="/productcommentssave.action"
> method="post">
> 26 <table class="wwFormTable">
> 27 <tr errorFor="productcommentssave_productComment_emailAddress">
> 28 <td align="center" valign="top" colspan="2"><span class="errorMessage">Email
> address is required!</span></td>
> 29 </tr>
> 30 <tr>
> 31 <td align="left" valign="top" colspan="2"><label for="productcommentssave_productComment_emailAddress"
> class="errorLabel">Email address:</label></td>
> 32 </tr>
> 33 <tr>
> 34 <td
> 35><input type="text" name="productComment.emailAddress" size="40" maxlength="128"
value=""
> id="productcommentssave_productComment_emailAddress"/></td>
> 36 </tr>
> ...
>
> I get this xhtml-validation-message from w3c:
>
> Line 27, Column 23: there is no attribute "errorFor"
> <tr errorFor="productcommentssave_productComment_emailAddress">
>
> You have used the attribute named above in your document, but the document type you are
using
> does not support that attribute for this element. This error is often caused by incorrect
> use of the "Strict" document type with a document that uses frames (e.g. you must use
the
> "Transitional" document type to get the "target" attribute), or by using vendor proprietary
> extensions such as "marginheight" (this is usually fixed by using CSS to achieve the
desired
> effect instead).
> This error may also result if the element itself is not supported in the document type
you
> are using, as an undefined element will have no supported attributes; in this case, see
the
> element-undefined error message for further information.
> How to fix: check the spelling and case of the element and attribute, (Remember XHTML
is all
> lower-case) and/or check that they are both allowed in the chosen document type, and/or
use
> CSS instead of this attribute. If you received this error when using the <embed>
element
> to incorporate flash media in a Web page, see the FAQ item on valid flash.
>
> What do you you think guys? The tr-tag does not look OK according to me, but I might
be wrong?
> What is this attribue "errorFor", how is it used by struts?
> Do you guys see any solution to this?
>
> Best regards
> Fredrik
> ---------------------------------------------------------------------
> 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


Mime
View raw message