开发者

extjs standardSubmit and grid inside a form problem

I'm having some weird issue with extjs. I have a form and a grid, each works great separately but when I put the grid inside the form, everything starts to f开发者_如何学编程all to pieces.

My point by doig so would be to be able to submit ids from rows of the grid and at the same time, stuff from the form. To do so, I put the standardSubmit to false and added a javascript method to the onSubmit attriobute of my form.

However, when I submit the form this way, I get a weird error :

Uncaught SynthaxError: Unexpected token <

But the form values are submitted and visible in the request's header. Of course, when I put the standard submit to true, the error goes away but the values from the grid are not submitted anymore...


This SyntaxError usually relates to a loaded JavaScript resource. These are common mistakes that can trigger this error message:

<script type="text/javascript">
  <script type="text/javascript">
  [...]
  </script>
</script> 

<script type="text/javascript">
    var s = I forgot the opening quotes so this <html> tag will break the script';
</script>

<script type="text/javascript"
    var s = 'Here we forgot to close the opening <script> tag! Boom!';
</script>

It could also be triggered by the server setting the content type to 'application/javascript' for a non-JS resource (which then again includes this tags).

I also remember reading that this happened to someone using a minified version of a JavaScript library, but no details on the exact reason were given (other than that the problem was solved by using the non-minified version.

You can also wrap your JS resources in a CDATA tag for debugging purposes which should get rid of the SyntaxError and probably bring up a standard JS error message for the invalid script.

<script><![CDATA[

/* Code here */

]]></script>

Once you identify the resource that triggers the exception it should be possible to spot the problem by doing a through study of the source with your CSI sunglasses on.

Note: my assumption is that it can*not* be triggered by data that is sent to the server, but only data that is returned from the server. This is because the error refers to the parsing process on the client. But I'm not 100% sure on this one.

If this doesn't help you should really post the involved code and/or explain what you do exactly when you 'added a javascript method to the onSubmit attribute of [your] form'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜