1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    3
    Vote Rating
    0
    Varun is on a distinguished road

      0  

    Default FormPanel submit.

    FormPanel submit.


    Im very much new to Ext Js. I had an application developed using html,jsp's and java code. I have used Ext js for the look and feel. I have used a Form panel and on submit the url fired calls a jsp file.I have used the form.submit() as per the documentation. But on pressing submit there happens to be a syntax error. when i try to debug in Visual studio i see there is a line ext-all.js : return eval("("+json+")") which i believe is the place where it is failing.It is trying to evaluate the entire jsp file which has html codes, java codes, ext codes etc.. is not possible to direct to a jsp file on submit?

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    1) Please post your code
    2) Check that your JSON is returning at least: { "success" : true }

  3. #3
    Ext User
    Join Date
    Feb 2008
    Posts
    3
    Vote Rating
    0
    Varun is on a distinguished road

      0  

    Default


    The Form Panel definition using Ext js

    .....
    var Attention = new Ext.form.Checkbox({
    name: 'attention',
    fieldLabel: 'Attention' });

    var Comments = new Ext.form.TextArea({
    name: 'comments',
    fieldLabel: 'Comments',
    width : 500,
    height : 200 });

    var gridForm = new Ext.form.FormPanel({
    id: 'commentsForm',
    frame: true,
    labelAlign: 'left',
    width: 1000,
    baseCls:'x-plain',
    url:'addbook.php',
    method: 'POST',
    autoScroll:true,
    buttonAlign:'left',
    height:370,
    items: [{
    xtype: 'fieldset',
    labelWidth: 90,
    border: false,
    contentEl:'Form3',
    items: [Attention,Comments]
    }]
    });
    var updateButton = gridForm.addButton('Update',function(){
    updateComment(EmpDrop,ScrNo,gridForm);
    });
    ...



    The jsp code where the form is being submitted, as you can see above there is a function call on the click of update button
    ......
    function updateComment(EmpDrop,ScrNo,gridForm){
    var scrno = ScrNo.getValue();
    if(document.getElementById('users').disabled==true){
    username = "<%= session.getAttribute("username")%>"
    }
    else{
    username = EmpDrop.getValue();
    index = EmpDrop.selectedIndex;
    }
    gridForm.getForm().submit({url:"/webtrack/XmlCreate.jsp",waitMsg:'Saving Data...'});
    }......



    It is the 'submit' which is throwing the syntax error as mentioned in my first post to this thread.Let me know if any other info is needed...

    Thanks a lot

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    please repost your code in php or code tags in the future.

    you'll need a success and failure handlers in your submit() function.

  5. #5
    Ext User
    Join Date
    Feb 2008
    Posts
    3
    Vote Rating
    0
    Varun is on a distinguished road

      0  

    Default


    Even after adding 'success' and 'failure' the error is being thrown. Actually what i have done is i ahve created the entire UI using Ext js and hence no HTML content. I just have empty <div> tags in the HTML code where these Ext components are rendered to. The jsp file which has the HTML code also have some java coding and other logic written inorder to fire different url's having different parametr values. So when i press the submit button the parameter values in the url are created on the fly . Always the same jsp page is called. Can you tell me a way to do this. Im trying to do it in a way as posted above. Thanks in advance

  6. #6
    Ext User
    Join Date
    Jan 2008
    Posts
    14
    Vote Rating
    0
    Sunech is on a distinguished road

      0  

    Default


    Did you manage to resolve your issue? I have an issue relating to a similar method (submitting through a custom function), but I am getting an error that my formpanel variable is not defined. In your example, doesn't it state that gridForm is not defined?

    My formpanel is within ext onready and the submit function is after the onready function, is your script composed in the same way?

    Thanks.

  7. #7
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    what is your server returning?

Thread Participants: 2