Results 1 to 2 of 2

Thread: I can't submit a form ::>_<::

  1. #1

    Question I can't submit a form ::>_<::

    Dear all,
    this is html code:
    Code:
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>04.form</title>
            <link rel="stylesheet" type="text/css" href="ExtJs/resources/css/ext-all.css" />
            <script type="text/javascript" src="ExtJs/adapter/ext/ext-base.js"></script>
            <script type="text/javascript" src="ExtJs/ext-all.js"></script>
            <script type="text/javascript">
    Ext.onReady(function(){
    
        var form = new Ext.form.FormPanel({
            defaultType: 'textfield',
            labelAlign: 'right',
            title: 'form',
            labelWidth: 50,
            frame:true,
            width: 220,
            url: 'testsubmit.aspx',
    
            items: [{
                fieldLabel: 'test',
                name: 'text'
            }],
            buttons: [{
                text: 'submit',
                handler: function() {
                Ext.getDom(form).form.submit({
                        success:function(form, action){
                            Ext.Msg.alert('message', action.result.msg);
                        },
                        failure:function(){
                            Ext.Msg.alert('Error','Error');
                        }
                    });
                }
            }]
        });
        form.render("form");
    
    });
            </script>
        </head>
        <body>
            <div id="form" style="margin:100px;"></div>
        </body>
    </html>
    and this is my asp.net (C#) code, it only request["text"] and show it.
    asp.net code
    Code:
    protected void Page_Load(object sender, EventArgs e)
            {
                if (Request.Params["text"] != null)
                {
                    Response.Write(Request.Params["text"]);
                    Response.End();
                }
                Response.Write("success:true");
                Response.End();
            }
    when I click submit button, it never return "success" (always alert('Error' , 'Error')
    and I set a broken point in testsubmit.aspx, it never run there.

    what can I do, please help. Thanks.

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Ext.getDom(form).form? That would return the <form> element!

    You want:
    Code:
    form.getForm().submit({...});
    Also, your server should return valid JSON, e.g.
    Code:
    {"success": true}
    ps. This is best created using a JSON library and not by building the string yourself.

Similar Threads

  1. How to submit the grid value using form submit?
    By ajax&me in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 28 Sep 2009, 6:30 AM
  2. form.submit doesn't call url in form submit action
    By webwolfi in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 26 Apr 2009, 10:16 AM
  3. tree: submit checkboxes with form.submit
    By perler in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 24 Mar 2008, 4:49 AM
  4. Form without submit button, handling submit with shift+enter...
    By violinista in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 5 Jun 2007, 12:02 AM
  5. ID of submit within form masks submit function
    By aconran in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 19 Feb 2007, 12:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •