1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
    msuchwalko is on a distinguished road

      0  

    Default Unanswered: Submiting an Form problem

    Unanswered: Submiting an Form problem


    Hello,

    I would like to ask for some help please. I am trying to submit form with filefields. Doing it like in tutorials, but my app dont want to work with me.

    In controler i have such function
    Code:
        saveProduct: function(button) {        var form = button.up('form').getForm();
                            if(form.isValid()){
                        form.submit({
                            disableCaching : true,
                            timeout: 5,
                            scope: this,
                            url: 'api.php/dodaj_produkty.json',
                            waitMsg: 'Uploading your photo...',
                            success: function(Form, action) {
                                Ext.Msg.alert('Ze niby sukceasdsads');
                            },
                            failure: function(fp, o) {
                                Ext.Msg.alert('Not success');
                            }
                        });
                    }
        }
    My form:
    Code:
    Ext.define('Santi.view.Product.NewProductForm', {    extend: 'Ext.form.Panel',
        alias: 'widget.productform',
        autoHeight: true,
        width: '100%',
        border: 0,
        initComponent: function() {         
            this.items = [
            {
                xtype: 'fieldset',
                plain: true,
                frame: true,
                border: 0,
                bodyPadding: 5,
                defaults: {
                    xtype: 'textfield',
                    labelWidth: 130,
                    inputType: 'text',
                    anchor: '50%',
                    selectOnFocus: true,
                    required: true
                },
                items: [
                {
                    itemId: 'name',   
                    fieldLabel: Ext.i18n.appBundle.getMsg('productForm.name'),
                    name: 'name'
                },
                {
                    xtype: 'checkboxgroup',
                    fieldLabel: Ext.i18n.appBundle.getMsg('productForm.available_size'),
                    columns: 3,
                    vertical: true,
                    items: [
                    {
                        boxLabel: 'XS', 
                        name: 'item_size', 
                        inputValue: '0'
                    },
                    {
                        boxLabel: 'S', 
                        name: 'item_size', 
                        inputValue: '1' 
                    },
                    {
                        boxLabel: 'M', 
                        name: 'item_size', 
                        inputValue: '2'
                    },
                    {   
                        boxLabel: 'L', 
                        name: 'item_size', 
                        inputValue: '3'
                    },
                    {
                        boxLabel: 'XL', 
                        name: 'item_size', 
                        inputValue: '4'
                    },
                    {
                        boxLabel: 'XXL', 
                        name: 'item_size', 
                        inputValue: '5'
                    },
                    {
                        boxLabel: 'one-size', 
                        name: 'item_size', 
                        inputValue: '6'
                    }
                    ]
                },
                {
                    xtype: 'textareafield',
                    itemId: 'description',   
                    fieldLabel: Ext.i18n.appBundle.getMsg('productForm.description'),
                    name: 'description',
                    grow      : true,
                    anchor    : '60%'
                },
                {
                    xtype: 'filefield',
                    id: 'photo1',
                    name: 'photo1',
                    fieldLabel: Ext.i18n.appBundle.getMsg('productForm.photo')+' 1',
                    msgTarget: 'side',
                    allowBlank: true,
                    anchor: '60%',
                    buttonText: Ext.i18n.appBundle.getMsg('productForm.photo_select'),
                    validator: this.isPicture
    
    
                },
                {
                    xtype: 'filefield',
                    name: 'photo2',
                    fieldLabel: Ext.i18n.appBundle.getMsg('productForm.photo')+' 2',
                    msgTarget: 'side',
                    allowBlank: true,
                    anchor: '60%',
                    buttonText: Ext.i18n.appBundle.getMsg('productForm.photo_select'),
                    validator: this.isPicture
                },
                {
                    xtype: 'filefield',
                    name: 'photo3',
                    fieldLabel: Ext.i18n.appBundle.getMsg('productForm.photo')+' 3',
                    msgTarget: 'side',
                    allowBlank: true,
                    anchor: '60%',
                    buttonText: Ext.i18n.appBundle.getMsg('productForm.photo_select'),
                    validator: this.isPicture
                },
                {
                    xtype: 'button',
                    type: 'reset',
                    text: Ext.i18n.appBundle.getMsg('productForm.reset'),
                    handler: function() {
                        this.up('form').getForm().reset();
                    },
                    region: 'east',
                    anchor: '20%',
                    margin: '20 0 0 10'
                }
                ]
            }
            ];
                  
            this.callParent(arguments);
        },
        setDefaultValue: function() {
            var me = this.me;
            var combo = me.down('combobox[name=client_type_id]');
            combo.setValue(this.client_type_id);
        },
        isPicture: function() {
            if(this.getValue().length == 0){
                return true;
            }
            var imageRegex = /(\.|\/)(gif|jpe?g|png|bmp)$/i;
            if(this.getValue().match(imageRegex) == null) {
                return Ext.i18n.appBundle.getMsg('productForm.photo_invalid');
            }
            else {
                return true;
            }
        }
    });
    And in PHP
    Code:
        public function executeAdd(sfWebRequest $request) {        $this->getResponse()->setContentType('text/json');
            $result['success'] = false;
            $result['error']['clientCode'] = "Client not found";
            return $this->renderText(json_encode($result));
    
    
        }
    Thing is no data seems to be POSTED. In firefox status that controller returns is always succesfull submit message. No firebug errors. In chrome uploading freeze in waitMSG and in Console i get some sort of recurention: interface/interface/interface/interface/interface/designer.html 403 (Forbidden)

    And that recurention is longer

    Do u guys have any idea what I do wrong? Looking forward any response. Ty




  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Can you verify your header is correctly sending the data, the server has received the data and it exists in the table and is sending back the correct data at the server and as a response?

    Scott.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi