1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    144
    Answers
    19
    Vote Rating
    0
    coletek is on a distinguished road

      0  

    Default Answered: How do I add a variable to a form panel

    Answered: How do I add a variable to a form panel


    Say I have a form with one field such as below, then how do I add a addition value to the form values, so its passed in the submit() call (as commented below):

    Code:
    Ext.define("test.view.AddCommentForm", {
        extend: 'Ext.form.Panel',
        xtype: 'addcommentform',
    
    
        requires: [
            'Ext.form.TextArea',
            'Ext.field.Hidden'
        ],
    
    
        config: {
            title: 'Add Comment',
            url: 'backend/add_comment.php',
            scrollable: false,
    
    
            items: [
                {
                    xtype: 'fieldset',
                    title: 'Add Comment',
    
    
                    items: [
                        {
                            xtype: 'textareafield',
                            name: 'comment',
                            label: 'Comment',                                     
                            labelWidth: 150,
                            placeHolder: '',
                            required: true,
                            margin: 20,
                        }
                    ]
                },
                {
                    id: 'button-send',
                    xtype: 'button',
                    text: 'Send',
                    ui: 'confirm',
                    handler: function() {
    
    
                        var to_user_id = 50; // how do I add this to the form values, so they get passed in the submit call below, without having to add it to the item list above?
    
    
                        var values = this.up('addcommentform').getValues();
    
    
                        if (!values.comment)
                        {
                         	Ext.Msg.alert('Add Comment', 'Please enter your comment');
                        }
                        else if (!values.to_user_id) // clearly this will not work until the above variable to_user_id is added to the values
                        {
                         	Ext.Msg.alert('Add Comment', 'No user selected');
                        }
                        else
                        {
                         	this.up('addcommentform').submit({
                                success: function(form, result) {
    				Ext.Msg.alert('Add Comment', 'Added comment successfully');
    				form.reset();
                                },
                                failure: function(form, result) {
    				Ext.Msg.alert('Add Comment', 'An error occurred, please try again later');
                                }
    			});
                        }
    
    
    		}
    
    
                }
    	]
    
    
        }
    
    
    });
    What comes around goes around

  2. Solved with following after "var to_user_id = 50;"

    Code:
    this.up('addcommentform').add({
                            xtype: 'hiddenfield',
                            name: 'user_id',
                            value: to_user_id
                        });

  3. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    144
    Answers
    19
    Vote Rating
    0
    coletek is on a distinguished road

      0  

    Default


    Solved with following after "var to_user_id = 50;"

    Code:
    this.up('addcommentform').add({
                            xtype: 'hiddenfield',
                            name: 'user_id',
                            value: to_user_id
                        });
    What comes around goes around

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