找了一整天了 实在不知道哪里有错 各位前辈多指教 代码很容易读的..     这段程序的起始页是个表格 里面有数据 设置每次只能选择一行数据 当点击添加按纽的时候 弹出一个窗口 用户输入数据后 提交表单 
    提交的时候程序没有进入后台 ExtJs 的 ext-all.js 的第7942行 页面上说是语法错误     
        /*********** 数据源代理 */
        var rcsrproxy = new Ext.data.HttpProxy({
            url : path + "/dsGrkhxxQuery.do?StoreFlag=32"
        });
        /************ JSon */
        var rcsrreader = new Ext.data.JsonReader(
            {totalProperty : 'totalProperty',root : 'root'}, 
            [ {name : 'pcfid'},
  {name : 'cusId'},
  {name : 'incomingFlag'},
  {name : 'incomingFlagname'},
  {name : 'monIncoming'},
  {name : 'updateDate'},
  {name : 'updPersonCode'}
            ]
        );
        /************ 数据转换 */
        var rcsrInfoStore = new Ext.data.Store({
            proxy: rcsrproxy,
            reader: rcsrreader
        });
        //表模型
        var rcsrcolModel = new Ext.grid.ColumnModel([
            {header:'用户代码',dataIndex:'cusId', sortable: true},
            {header:'收入标志',dataIndex:'incomingFlagname', sortable: true},
            {header:'收入金额',dataIndex:'monIncoming', sortable: true},
            {header:'最后更新时间',dataIndex:'updateDate', sortable: true},
            {header:'更新柜员',dataIndex:'updPersonCode', sortable: true}
        ]);
        //声明一个add窗口 用于点击按纽时 弹出
        var addRcsrWindow;
        //设置这个add窗口中的表单元素
        var addRcsrForm = new Ext.form.FormPanel({
            id:'addRcsrForm',
            frame: true,
            url: "grkhRcsrManageCon.do",//提交到后台 但是这里没有调到后台 就报错了
            items:[{
                xtype : 'textfield',
                name : 'cusId',
                id : 'cusId',
                fieldLabel : '客户代码',
                allowBlank : false,
                blankText : '柜员号不能为空',
                disabled : true,
            },{
                xtype : 'textfield',
                id: 'addincomingFlag',
                name: 'addincomingFlag',
                fieldLabel: '收入标志',
                allowBlank : false,
                blankText : '请选择收入标志',
            },{
                xtype : 'numberfield',
                name: 'addmonIncoming',
                id : 'addmonIncoming',
                fieldLabel: '收入金额',
                allowBlank : false,
                blankText : '请选择岗位角色',
            },{
                name: 'form_flag',
                xtype: 'textfield',
                value: 1,
                hidden: true
            }] 
        });    //工具条 工具条里包含添加按纽 当点击 就弹出刚才的表单
    var rcsrManageBar = new Ext.Toolbar({
        items : [,'-',{
            xtype: 'tbbutton',
            text: '添加日常收入',
            iconCls: 'currencyAdd',
            handler: function(){
                if(addRcsrWindow == null){
                addRcsrWindow = new Ext.Window({
                    title: '添加日常收入窗口',
                    iconCls: 'currencyAdd',
                    modal: true,//模态窗口
                    width: 350,
                    height: 200,
                    closeAction:'hide',
                    items: addRcsrForm,
                    buttons: [{
                        text:'添加',
                        iconCls:'button_yes',
                        handler: function(f,a){
                            addRcsrForm.getForm().findField('cusId').enable();
                            var a_cusID = addRcsrForm.getForm().findField('cusId').value;
                            var a_addincomingFlag = addRcsrForm.getForm().findField('addincomingFlag').value;
                            var a_addmonIncoming = addRcsrForm.getForm().findField('addmonIncoming').value;

                            if(a_cusID == null || a_cusID == ""){
                                Ext.Msg.alert('警告','用户代码不能为空!');
                            }

                            if(a_addincomingFlag == null || a_addincomingFlag == ""){
                                Ext.Msg.alert('警告','收入标志不能为空!');
                            }                            if(a_addmonIncoming == null || a_addmonIncoming == ""){
                                Ext.Msg.alert('警告','收入金额不能为空!');
                            }

                            addRcsrForm.getForm().submit({
                                //显示这个进度条后报错 错误是 ext-all.js 的第7942行 语法错误 
                                //这行的内容 return eval("(" + json + ')'); 是这个 
                                waitMsg : '个人客户 - 日常收入添加中,请稍后......',
                                success : function(form, action) {
                                Ext.Msg.alert('提示','添加个人客户 - 日常收入信息成功!')                    },
                   failure : function(form, action) {
                       Ext.MessageBox.alert('警告', '添加个人客户 - 日常收入信息失败! ');
                            }
                        });
                   }
                }})};                //在程序的开始 有个地方是从父窗口赋值到子窗口 
                var vcusId = addRcsrForm.getForm().findField('cusId').value;

                if(vcusId == null || vcusId == ""){
                    Ext.Msg.alert('警告','请选择一条日常收入信息');
                    return null;
                }

                addRcsrWindow.show();
                addRcsrWindow.findByType('textfield')[1].focus(true, true);
            }
        }
        Ext.onReady(function(){
            var rcsrInfoPanel = new com.panels.RcsrInfoGrid({
                renderTo: 'rcsrManage',
                tbar: rcsrManageBar,
                sm: new Ext.grid.RowSelectionModel({//行选择
                    singleSelect: true,//只能选择一行
                    listeners: {
                        rowselect: function(sm, row, rec) {//当行被选择
                            Ext.getCmp("addRcsrForm").getForm().loadRecord(rec);//向子窗口传值
                        }
                    }
                }),
                listeners: {
                    viewready: function(g) {
                        g.getSelectionModel().selectRow(0);//默认选择行
                    },'render' : function(){
                        Ext.getCmp('var_cusId').focus(true,true);//默认焦点
                    }
                }
            }); 
    })
    

解决方案 »

  1.   

    在提交的地方写urlxtype:"button",
    width:80,
    text:"确定",
    handler:function(){
    if(Ext.getCmp('newProductForm').getForm().isValid()){
    Ext.getCmp('newProductForm').form.submit({
       clientValidation:true,
       waitMsg:'正在添加数据,请稍后......',
       waitTitle:'提示',
       url:'NewProductInStorage_execute',
       method:'post',
       success:function(form,action){
        store.reload({params:{start:0,limit:9}});
         Ext.Msg.alert('提示','添加数据成功!');
       //  window.location.href='index.jsp';
       },
       failure:function(form,action){
        Ext.Msg.alert('提示','添加数据失败,原因:'+action.result.error);
       }
       })
      

  2.   


    那个url下是什么? 
    我是新手 读ExtJs不太熟悉 
    前辈耐心指教.. 
      

  3.   

    如果是在IE下面的话,下面这类的逗号就是语法错误
    {
                    xtype : 'numberfield',
                    name: 'addmonIncoming',
                    id : 'addmonIncoming',
                    fieldLabel: '收入金额',
                    allowBlank : false,
                    blankText : '请选择岗位角色',
                }最后一个逗号不能写
      

  4.   


    可是这个后面 不是还有一个 listeners 监听事件 
    listeners 才是最后一个 
    这个后面没有逗号啊.. 
      

  5.   


    看那个错误行 应该是Json的格式 
    因为那一句正好是 eval("(" + Json + ")")
    正好在执行 Json
      

  6.   

    哥们,你写法果然有问题,我把你代码copy来一看,6个语法错误
      

  7.   

    addRcsrForm的items里第一、二、三项里面的最后一个,去掉
    rcsrManageBar里面的 Ext.Msg.alert('提示','添加个人客户 - 日常收入信息成功!')这句中后面的括号是汉语的,改成英文的;而且这个对象里面的{}对应也有问题  自己找找
      

  8.   


    恩 页面是说语法错误 
    然后我改了个地方 
    再提交表单 就转到了 
        failure : function(form, action) {
            Ext.MessageBox.alert('警告', '添加个人客户 - 日常收入信息失败! ');
        }
    提交失败的提示.. 
    但是也没进数据库 
      

  9.   

        那怎么办.. 
        我在最后那个逗号后面都加上了类似以下这样的代码 
        listeners : {
            specialkey : function(f, e) {
                if (e.getKey() == e.ENTER || e.getKey() == 40) {
                    addRcsrForm.getForm().findField('monIncoming').focus(true,true);
                }
            }
        }
        就是捕获键盘事件 设置焦点