You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jeroen Simons (JIRA)" <ji...@apache.org> on 2008/10/10 06:50:37 UTC

[jira] Created: (WW-2835) Dojo and file input

Dojo and file input
-------------------

                 Key: WW-2835
                 URL: https://issues.apache.org/struts/browse/WW-2835
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - Dojo Tags
    Affects Versions: 2.0.11.2
         Environment: Mac OSX 10.4.11, java 1.5
            Reporter: Jeroen Simons


Using the code below everything works as expected. On form submission an ajax call is made to the alert() method which simply forwards to alert.jsp which alerts the filled in text and a dom reference of the form.

As soon as i add a <input type="file"> or <s:file> to my form, alert.jsp does not have a reference to the form anymore and the 2nd alert fails.

This is my code:

@Namespace(value = "/ajax")
@Results({
    @Result(name = "success", value = "test.jsp"),
    @Result(name = "alert", value = "alert.jsp")
})
public class TestAction extends ActionSupport {

    public String alert() throws Exception {
        return "alert";
    }

    private String text;

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}

alert.jsp:

<script type="text/javascript">
    alert("${text}");
    alert(document.getElementById("testForm"));
</script>

test.jsp:

<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
    <s:head theme="ajax" />
</head>
<body>

    <s:form id="testForm" name="testForm" onsubmit="dojo.event.topic.publish('alert_text');return false;"  enctype="multipart/form-data">
        Text: <s:textfield name="text" />
        <br />
        <%--<s:file name="file" />--%>
        <s:submit  />
    </s:form>

    <s:url id="url" action="test" method="alert" namespace="/ajax" />
    <s:div executeScripts="true" showLoadingText="false" id="testdiv" href="%{url}" theme="ajax"
           listenTopics="alert_text" formId="testForm" />

</body>
</html>


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