Hi,

I am using T 5.3-rc-3 and I am getting the following error message while
submitting any forms in my app: 

--- 
A JSONArray text must start with '[' at character 1 of "[\"save\",
\"save\"]"
--  

Stack trace:
--
org.apache.tapestry5.json.JSONTokener.syntaxError(JSONTokener.java:384)
org.apache.tapestry5.json.JSONArray.parse(JSONArray.java:126)
org.apache.tapestry5.json.JSONArray.<init>(JSONArray.java:95)
org.apache.tapestry5.corelib.components.Form.isFormCancelled(Form.java:590)
org.apache.tapestry5.corelib.components.Form.advised$onAction_12585e84eba88bfd(Form.java:511)
org.apache.tapestry5.corelib.components.Form$Invocation_onAction_12585e84eba88bfc.proceedToAdvisedMethod(Unknown
Source)
org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:
...
---
What's puzzling is that the form works in a dummy app but fails in the core
(complex) app. This makes me believe that there is something else that is
interfering with tapestry. I've also noticed that if I disable Javascript in
the browser, the submission is  successful. 

It looks as if: 
String raw = request.getParameter(SUBMITTING_ELEMENT_ID);

in Form.isCancelled() is returning a String in double quotes (in my case)
but I can't figure out where this is created. 

Has anybody else seen this? 


Below is an excerpt:

java class:

 ....
  void onSuccess() {
      
       String uploadDir = context.getRealFile("/").getAbsolutePath() +
"/resources";    
        File dirPath = new File(uploadDir);

        if (!dirPath.exists()) {
            dirPath.mkdirs();
        }

        File copied = new File(uploadDir , file.getFileName());
        file.write(copied);

   }

tml:

....
 <form t:type="form" t:id="upload" clientValidation="none">
        <ul>
            <li>
                <label t:type="label"  for="name"/>
                <input t:type="textfield" t:id="name" validate="required"/>
            </li>
            <li>
                <label t:type="label"  for="file"/>
                <input t:type="upload" t:id="file" validate="required"/>
            </li>
            <li>
                <input t:type="submit"   value="Upload" t:id="save" />
                 
                    <input type="button" value="Cancel"/>
                 
            </li>
        </ul>
    </form>
...


--
Thanks,

/Serge


--
View this message in context: 
http://tapestry-users.832.n2.nabble.com/5-3-JSONArray-Error-while-submitting-forms-tp7018161p7018161.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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

Reply via email to