Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    78
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default Submitting a form

    Submitting a form


    Hello everyone.

    I've copied this code into my appliation.

    HTML Code:
    Ext.onReady(function() {
        Ext.create('Ext.form.Panel', {        title: 'Simple Form',        bodyPadding: 5,        width: 350,
            // The form will submit an AJAX request to this URL when submitted        url: 'save-form.php',
            // Fields will be arranged vertically, stretched to full width        layout: 'anchor',        defaults: {            anchor: '100%'        },
            // The fields        defaultType: 'textfield',        items: [{            fieldLabel: 'First Name',            name: 'first',            allowBlank: false        },{            fieldLabel: 'Last Name',            name: 'last',            allowBlank: false        }],
            // Reset and Submit buttons        buttons: [{            text: 'Reset',            handler: function() {                this.up('form').getForm().reset();            }        }, {            text: 'Submit',            formBind: true, //only enabled once the form is valid            disabled: true,            handler: function() {                var form = this.up('form').getForm();                if (form.isValid()) {                    form.submit({                        waitMsg: 'Saving Data...',                        success: function(form, action) {                           Ext.Msg.alert('Success', action.result.msg);                        },                        failure: function(form, action) {                            Ext.Msg.alert('Failed', action.result.msg);                        }                    });                }            }        }],        renderTo: 'form-block'    });    });


    Then i've created the save-form.php like this:

    PHP Code:
    <?
    $first 
    $_POST['first'];$last $_POST['last'];
    $num "test.txt";$var=fopen($num,"w"); fwrite($var$first.' - '.$last);fclose($var);
    ?>
    And the test.txt file.

    When i compile the form and click on Submit, appear a message box with the 'Please Wait' text and a blue slider, and it continues to slide indefinitely. Why this happens? Moreover the txt files remains blank.

    Thanks for reply

    EDIT: the extjs code is the same of Example Usage of Ext.form.Panel in the API. I couldn't copy well it here, sorry.

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    78
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default


    Solved

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    78
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default


    I have to re-open this thread for another question:

    this is my code (i hope it will look better than above).

    Code:
    Ext.onReady(function() {
    
     Ext.create('Ext.form.Panel', {
      title: 'Simple Form',
      bodyPadding: 5,
      width: 350,
    
    
      // The form will submit an AJAX request to this URL when submitted
      url: 'save-form.php',
      
      // Fields will be arranged vertically, stretched to full width
      layout: 'anchor',
      defaults: {
       anchor: '100%'
      },
    
    
      // The fields
      defaultType: 'textfield',
      items: [{
       fieldLabel: 'First Name',
       name: 'first',
       id: 'first',
       allowBlank: false
      },{
       fieldLabel: 'Last Name',
       name: 'last',
       id: 'last',
       allowBlank: false
      }],
    
    
      // Reset and Submit buttons
      buttons: [{
       text: 'Reset',
       handler: function() {
        this.up('form').getForm().reset();
       }
      }, {
       text: 'Submit',
       formBind: true, //only enabled once the form is valid
       disabled: true,
       handler: function() {
        var form = this.up('form').getForm();
        if (form.isValid()) {
         form.standardSubmit = true;
         form.submit({
          success: function(form, action) {
             Ext.Msg.alert('Success', action.result.msg);
          },
          failure: function(form, action) {
           Ext.Msg.alert('Failed', action.result.msg);
          }
         });
        }
       }
      }],
      renderTo: 'form-block'
     });
     
    });
    It work fine but when i press Submit it switch to the php page indicated in the url. So the success block is useless; i want to use something like json, if is possible, in order to ensure that the server do what he must do, and after sends a response to client that displays a message according to this response.

    Is it possible?