You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Robert Shanahan (JIRA)" <ji...@apache.org> on 2007/05/01 19:18:44 UTC

[jira] Created: (WW-1903) Client side javascript validation has javascript errors when textfield labelposition is set to top

Client side javascript validation has javascript errors when textfield labelposition is set to top
--------------------------------------------------------------------------------------------------

                 Key: WW-1903
                 URL: https://issues.apache.org/struts/browse/WW-1903
             Project: Struts 2
          Issue Type: Bug
          Components: Misc
    Affects Versions: 2.0.6
         Environment: JDK1.5.0_09, JBoss 4.0.5, Windows XP SP2
            Reporter: Robert Shanahan
            Priority: Minor


Using client side pure javascript field validation results in [Object Error] alert box in IE and "TypeError: label has no properties" alert box in FF.

<s:form action="authenticate" validate="true">
   <s:textfield key="login.name" name="name" value="%{name}" tabindex="1" labelposition="top"/>
   <s:password key="login.password" name="password" tabindex="2" labelposition="top"/>
   <s:submit type="image" src="images/goButton.gif" tabindex="3"/>
</s:form>

I've isolated the error to the following method in validation.js:

function addError(e, errorText) {
    try {
        // clear out any rows with an "errorFor" of e.id
        var row = e.parentNode.parentNode;
        var table = row.parentNode;
        var error = document.createTextNode(errorText);
        var tr = document.createElement("tr");
        var td = document.createElement("td");
        var span = document.createElement("span");
        td.align = "center";
        td.valign = "top";
        td.colSpan = 2;
        span.setAttribute("class", "errorMessage");
        span.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute
        span.appendChild(error);
        td.appendChild(span);
        tr.appendChild(td);
        tr.setAttribute("errorFor", e.id);;
        table.insertBefore(tr, row);

        // updat the label too
        var label = row.cells[0].getElementsByTagName("label")[0];
        label.setAttribute("class", "errorLabel");
        label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
    } catch (e) {
        alert(e);
    }
}

I've worked around it by comparing 'label' to null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-1903) Client side javascript validation has javascript errors when textfield labelposition is set to top

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-1903.
---------------------------------

    Resolution: Fixed

> Client side javascript validation has javascript errors when textfield labelposition is set to top
> --------------------------------------------------------------------------------------------------
>
>                 Key: WW-1903
>                 URL: https://issues.apache.org/struts/browse/WW-1903
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Misc
>    Affects Versions: 2.0.6
>         Environment: JDK1.5.0_09, JBoss 4.0.5, Windows XP SP2
>            Reporter: Robert Shanahan
>         Assigned To: Musachy Barroso
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> Using client side pure javascript field validation results in [Object Error] alert box in IE and "TypeError: label has no properties" alert box in FF.
> <s:form action="authenticate" validate="true">
>    <s:textfield key="login.name" name="name" value="%{name}" tabindex="1" labelposition="top"/>
>    <s:password key="login.password" name="password" tabindex="2" labelposition="top"/>
>    <s:submit type="image" src="images/goButton.gif" tabindex="3"/>
> </s:form>
> I've isolated the error to the following method in validation.js:
> function addError(e, errorText) {
>     try {
>         // clear out any rows with an "errorFor" of e.id
>         var row = e.parentNode.parentNode;
>         var table = row.parentNode;
>         var error = document.createTextNode(errorText);
>         var tr = document.createElement("tr");
>         var td = document.createElement("td");
>         var span = document.createElement("span");
>         td.align = "center";
>         td.valign = "top";
>         td.colSpan = 2;
>         span.setAttribute("class", "errorMessage");
>         span.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute
>         span.appendChild(error);
>         td.appendChild(span);
>         tr.appendChild(td);
>         tr.setAttribute("errorFor", e.id);;
>         table.insertBefore(tr, row);
>         // updat the label too
>         var label = row.cells[0].getElementsByTagName("label")[0];
>         label.setAttribute("class", "errorLabel");
>         label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
>     } catch (e) {
>         alert(e);
>     }
> }
> I've worked around it by comparing 'label' to null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-1903) Client side javascript validation has javascript errors when textfield labelposition is set to top

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-1903:
--------------------------

    Fix Version/s: 2.1.0

> Client side javascript validation has javascript errors when textfield labelposition is set to top
> --------------------------------------------------------------------------------------------------
>
>                 Key: WW-1903
>                 URL: https://issues.apache.org/struts/browse/WW-1903
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Misc
>    Affects Versions: 2.0.6
>         Environment: JDK1.5.0_09, JBoss 4.0.5, Windows XP SP2
>            Reporter: Robert Shanahan
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> Using client side pure javascript field validation results in [Object Error] alert box in IE and "TypeError: label has no properties" alert box in FF.
> <s:form action="authenticate" validate="true">
>    <s:textfield key="login.name" name="name" value="%{name}" tabindex="1" labelposition="top"/>
>    <s:password key="login.password" name="password" tabindex="2" labelposition="top"/>
>    <s:submit type="image" src="images/goButton.gif" tabindex="3"/>
> </s:form>
> I've isolated the error to the following method in validation.js:
> function addError(e, errorText) {
>     try {
>         // clear out any rows with an "errorFor" of e.id
>         var row = e.parentNode.parentNode;
>         var table = row.parentNode;
>         var error = document.createTextNode(errorText);
>         var tr = document.createElement("tr");
>         var td = document.createElement("td");
>         var span = document.createElement("span");
>         td.align = "center";
>         td.valign = "top";
>         td.colSpan = 2;
>         span.setAttribute("class", "errorMessage");
>         span.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute
>         span.appendChild(error);
>         td.appendChild(span);
>         tr.appendChild(td);
>         tr.setAttribute("errorFor", e.id);;
>         table.insertBefore(tr, row);
>         // updat the label too
>         var label = row.cells[0].getElementsByTagName("label")[0];
>         label.setAttribute("class", "errorLabel");
>         label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
>     } catch (e) {
>         alert(e);
>     }
> }
> I've worked around it by comparing 'label' to null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WW-1903) Client side javascript validation has javascript errors when textfield labelposition is set to top

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso reassigned WW-1903:
-----------------------------------

    Assignee: Musachy Barroso

> Client side javascript validation has javascript errors when textfield labelposition is set to top
> --------------------------------------------------------------------------------------------------
>
>                 Key: WW-1903
>                 URL: https://issues.apache.org/struts/browse/WW-1903
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Misc
>    Affects Versions: 2.0.6
>         Environment: JDK1.5.0_09, JBoss 4.0.5, Windows XP SP2
>            Reporter: Robert Shanahan
>         Assigned To: Musachy Barroso
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> Using client side pure javascript field validation results in [Object Error] alert box in IE and "TypeError: label has no properties" alert box in FF.
> <s:form action="authenticate" validate="true">
>    <s:textfield key="login.name" name="name" value="%{name}" tabindex="1" labelposition="top"/>
>    <s:password key="login.password" name="password" tabindex="2" labelposition="top"/>
>    <s:submit type="image" src="images/goButton.gif" tabindex="3"/>
> </s:form>
> I've isolated the error to the following method in validation.js:
> function addError(e, errorText) {
>     try {
>         // clear out any rows with an "errorFor" of e.id
>         var row = e.parentNode.parentNode;
>         var table = row.parentNode;
>         var error = document.createTextNode(errorText);
>         var tr = document.createElement("tr");
>         var td = document.createElement("td");
>         var span = document.createElement("span");
>         td.align = "center";
>         td.valign = "top";
>         td.colSpan = 2;
>         span.setAttribute("class", "errorMessage");
>         span.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute
>         span.appendChild(error);
>         td.appendChild(span);
>         tr.appendChild(td);
>         tr.setAttribute("errorFor", e.id);;
>         table.insertBefore(tr, row);
>         // updat the label too
>         var label = row.cells[0].getElementsByTagName("label")[0];
>         label.setAttribute("class", "errorLabel");
>         label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
>     } catch (e) {
>         alert(e);
>     }
> }
> I've worked around it by comparing 'label' to null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.