cordField中的默认值在执行时引发JavaScript错误

cordField中的默认值在执行时引发JavaScript错误

本文介绍了RecordField中的默认值在执行时引发JavaScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向GridPanel Store添加以下记录字段会使该站点向Chrome控制台抛出JavaScript错误
未捕获SyntaxError:意外标识符

 < ext:RecordField Name =listnameAllowBlank =falseDefaultValue =Listname/> 
< ext:RecordField Name =recipientsAllowBlank =falseDefaultValue =Listmembers/>
< ext:RecordField Name =usageAllowBlank =true/>

Firebug控制台出现以下错误:

<$ p
...,名称:负责任的,defaultValue:请添加负责人/组(s)}]}),...
---------------------------------- ----------- |
admin.aspx(第16行,第60行)

看起来好像是默认值不正确引用为字符串,我该如何解决这个问题?

解决方案

似乎记录字段的默认值通常假定成为一个JavaScript变量。
双引号 defaultValue ='foo bar'修正了问题


Adding following Record Fields to the GridPanel Store makes the site throw a JavaScript Error
Uncaught SyntaxError: Unexpected identifier to the Chrome Console

<ext:RecordField Name="listname" AllowBlank="false" DefaultValue="Listname" />
<ext:RecordField Name="recipients" AllowBlank="false" DefaultValue="Listmembers" />
<ext:RecordField Name="usage" AllowBlank="true" />
<ext:RecordField Name="responsible" AllowBlank="false" DefaultValue="please add Responsible Person(s)/ Group(s)" />

Firebug console gives following error:

SyntaxError: missing } after property list
[Break On This Error]
...,name:"responsible",defaultValue:please add Responsible Person(s)/ Group(s)}]}),...
---------------------------------------------|
admin.aspx (line 16, col 60)

It looks as if the Default Value is not correctly quoted as String, how can I fix this?

解决方案

It seems the default Value of a Record Field is generally supposed to be a javascript variable.
double-quoting it defaultValue="'foo bar'" fixes the problem

这篇关于RecordField中的默认值在执行时引发JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 03:26