1. #11
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    Hello Dan,
    Thank you very much for all your wonderful help so far. I have almost done with this, but when I do the ajax submit of the form
    Code:
           feedform.getForm().submit({
    
            url: $baseUrl + 'feed-proxy.php',
    
            success: self.validateFeed,
    
            failure: function(){
    
                self.markInvalid();
    
            }
    and alert the responseXML we get the undefined message, ie xml is not properly accessible.
    I have attached the entire code for this.

    Code:
    Ext.namespace("myNS");
    myNS.FeedWindow = function(){
        var self = this;
    
        var feedform = new Ext.FormPanel({
            labelWidth: 75,
            labelAlign:'top',
            autoHeight: true,
            method: 'POST',
            fileUpload: true,
            //url: $baseUrl+'upload.php',
            //url: $baseUrl+'feed-proxy.php',
            border:false,
            bodyStyle:'background:transparent;padding:2px',
            width: 483,
            //height: 'auto',
            id: 'uploadform',
            items: {
                xtype:'tabpanel',
                activeTab: 0,
                defaults:{autoHeight:true, bodyStyle:'padding:10px'}, 
                bodyStyle:'background:transparent',
                items:[{
                    title:'Add feed',
                    bodyStyle:'background:transparent;padding:10px',
                    layout:'form',
                    width: 450,
                    items: [this.feedUrl = new Ext.form.ComboBox({
                        width: 450,
                        id: 'feed',
                        fieldLabel: 'Enter the URL of the feed to add',
                        emptyText: 'http://example.com/blog/feed',
                        validationEvent: false,
                        validateOnBlur: false,
                        msgTarget: 'under',
                        triggerAction: 'all',
                        displayField: 'url',
                        mode: 'local',
                        labelAlign:'top',
                
                        listeners:{
                            valid: this.syncShadow,
                            invalid: this.syncShadow,
                            scope: this
                        },
                        tpl: new Ext.XTemplate(
                                '<tpl for="."><div class="x-combo-list-item">',
                                '<em>{url}</em><strong>{text}</strong>',
                                '<div class="x-clear"></div>',
                                '</div></tpl>'),
                        store: new Ext.data.SimpleStore({
                            fields: ['url', 'text'],
                            data : this.defaultFeeds
                        })
                    }),
                    this.addpublish = new Ext.form.Checkbox({
                        id: 'add-publish',
                        fieldLabel: 'Automatically publish feeds (optional)',
                        items: {
                            width: 20,
                            name: 'add-publish',
                            value: '1'    
                        }
                    }),
                    this.thisfeedtag = new Ext.form.TextField({
                        id: 'add-feedtag',
                        fieldLabel: 'Tag feeds (optional)',
                        height: 'auto',
                        width: 450,
                        items: {
                            labelAlign:'top',
                            width: 450,
                            name: 'add-feedtag',
                            value: ''
                        }
                    }),this.acthidden = new Ext.form.TextField({
                           id: 'action',
                           value: 'feed_add',
                        inputType: 'hidden',
                        items: {
                            name: 'action',
                        }
                    })]
                },{
                    title:'Upload OPML Files',
                    layout:'form',
                    bodyStyle:'background:transparent;padding:10px',
                    labelAlign:'left',
                    defaultType: 'field',
                    items: [this.opmlfeedUrl = new Ext.form.TextField({
                        id: 'opml-url',
                        fieldLabel: 'Address of OPML file on the internet',
                        width: 350,
                        items: {
                            labelAlign:'top',
                            width: 350,
                            name: 'opml-url',
                        }
                    }),this.opmlbrowse = new Ext.form.TextField({
                           id: 'opml-upload',
                        fieldLabel: 'Upload an OPML file from your computer',
                        width: 350,
                           inputType: 'file',
                        items: {
                            labelAlign:'top',
                            width: 350,
                            opmlupload: 'opml-upload',
                            name: 'opmlupload',
                            value: ''    
                        }
                    }),this.opmlfeedpublish = new Ext.form.Checkbox({
                        id: 'opml-publish',
                        itemsAlign: 'left',
                        fieldLabel: 'Automatically publish feeds (optional)',
                        items: {
                            labelAlign:'right',
                            name: 'opml-publish',
                            value: ''    
                        }
                    }),this.opmlfeedtag = new Ext.form.TextField({
                        id: 'opml-feedtag',
                        fieldLabel: 'Tag feeds (optional)',
                        width: 350,
                        items: {
                            labelAlign:'top',
                            width: 350,
                            name: 'opml-feedtag',
                            value: ''    
                        }
                    })]
                }]
            }
        });
    myNS.FeedWindow.superclass.constructor.call(this, {
    
        title: 'Add Feed',
    
        iconCls: 'feed-icon',
    
        id: 'add-feed-win',
    
        autoHeight: true,
    
        width: 500,
    
        resizable: false,
    
        plain: true,
    
        modal: true,
    
        y: 100,
    
        autoScroll: true,
    
        closeAction: 'hide',
    
        height: 'auto',
    
        items: feedform,
    
        buttons: [{
    
        text: 'Add Feed!',
    
        handler: function(){
    
            feedform.getForm().submit({
    
            url: $baseUrl + 'feed-proxy.php',
    
            success: self.validateFeed,
    
            failure: function(){
    
                self.markInvalid();
    
            }
    
            });
    
        },
    
        scope: this
    
        }, {
    
        text: 'Cancel',
    
        handler: this.hide.createDelegate(this, [])
    
        }]
    
    });
    
    };
    
    
    
    Ext.extend(myNS.FeedWindow, Ext.Window, {
    
    defaultFeeds: [['http://www.divergingpath.com/rss.cfm?mode=full', 'Aaron Conran\'s Blog'], ['http://feeds.yuiblog.com/YahooUserInterfaceBlog', 'Yahoo! UI Blog'], ['http://feeds.feedburner.com/jquery/', 'jQuery Blog'], ['http://sports.yahoo.com/nba/rss.xml', 'NBA News'], ['http://feeds.dzone.com/dzone/frontpage', 'DZone.com']],
    
    
    
    show: function(){
    
        if (this.rendered) {
    
        this.feedUrl.setValue('');
    
        }
    
        myNS.FeedWindow.superclass.show.apply(this, arguments);
    
    },
    
    
    
    markInvalid: function(){
        this.feedUrl.markInvalid('The URL specified is not a valid RSS2 feed.');
    
        this.el.unmask();
    
    },
    
    
    
    validateFeed: function(response, options){
    
        var dq = Ext.DomQuery;
    
        var url = options.feedUrl;
    
        try {
    
        var xml = response.responseXML;
    alert(xml);
        var channel = xml.getElementsByTagName('channel')[0];
    
        var text;// = dq.selectValue('title', channel, url);
    
        // Add feed list in feed panel from the database
    
        Ext.Ajax.request({
    
            url: $baseUrl + 'feed_panel.php',
    
            params: {
    
            action: 'newfeed',
    
            newUrl: url
    
            },
    
            method: 'POST',
    
            scope: this,
            success: function(result, request){
    
        var stringData = result.responseText;
    
            if (channel) {
    
                // var description = dq.selectValue('description', channel, 'No description available.');
    
                this.el.unmask();
    
                this.hide();
    
                return this.fireEvent('validfeed', {
    
                url: url,
    
                text: result.responseText
    
                });
    
            }
    
    
    
            },
    
            failure: function(result, request){
    
            Ext.MessageBox.alert('Failed', result.responseText);
    
            }
    
        });
    
    
    
        } 
    
        catch (e) {
    
        this.markInvalid();
    
        }
    
    
    
    }
    
    });
    
    
    
    Ext.onReady(function(){
    
    var fw = new myNS.FeedWindow();
    
            fw.show();
    
    }, this);
    Thanks again...

  2. #12
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    When using BasicForm.submit, the success callback is passed form and action params, not response and options.

    If you use firebug and set a breakpoint in your callback, or simply console.log the params you'll see what you need to do.

  3. #13
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    Quote Originally Posted by danh2000 View Post
    When using BasicForm.submit, the success callback is passed form and action params, not response and options.

    If you use firebug and set a breakpoint in your callback, or simply console.log the params you'll see what you need to do.
    Hello Dan, Can you please explain " If you use firebug and set a breakpoint in your callback, or simply console.log the params you'll see what you need to do.".
    Sorry that I am not good in JS
    Thanks,

  4. #14
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Do you use Firebug? An extension to Firefox - if not, you should get it, or use the Aptana debugger.

    Anyway, with Firebug installed if you change your validate feed method like so:
    PHP Code:
    validateFeed: function(formaction){

        
    console.log(form);
        
    console.log(action); 
    You should see this in Firebug's console (note you have an error there too):



    Knowing that the second console.log was the action param, if I click it I see this:



    You can now see that action has a response object, containing the responseXML that you need.

    Debugging tools are essential really when developing.

    Note that in my example image you'll see that the XML doc comes from feed.xml - I don't have your feed-proxy.php script, so I just call a static xml file locally to load a document.

    Hope this helps,

  5. #15
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    Quote Originally Posted by danh2000 View Post
    Do you use Firebug? An extension to Firefox - if not, you should get it, or use the Aptana debugger.

    Anyway, with Firebug installed if you change your validate feed method like so:
    PHP Code:
    validateFeed: function(formaction){

        
    console.log(form);
        
    console.log(action); 
    You should see this in Firebug's console (note you have an error there too):



    Knowing that the second console.log was the action param, if I click it I see this:



    You can now see that action has a response object, containing the responseXML that you need.

    Debugging tools are essential really when developing.

    Note that in my example image you'll see that the XML doc comes from feed.xml - I don't have your feed-proxy.php script, so I just call a static xml file locally to load a document.

    Hope this helps,
    Hey Dan,
    thank you very much for your wonderful support.
    I use firebug, but not very familiar with all of its debugging capabilities, .
    Now, we got it almost the way, as we got the the XML in the console log, and I can traverse in the DOM tab nextchild attribute.
    But, when we come to the JS code, I dont get the responseXML value.
    I used
    Code:
     
    validateFeed: function(form, action){
      //  console.log(form);
        console.log(action); 
       // var dq = Ext.DomQuery;
       // var url = action.feedUrl;
            alert(action.responseXML);
        try {
            var action = action.responseXML;
            var channel = xml.getElementsByTagName('channel');
    How do we get the value within the JS code?

  6. #16
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    698
    Vote Rating
    3
    danh2000 is on a distinguished road

      0  

    Default


    Quote Originally Posted by adelphus View Post
    How do we get the value within the JS code?
    Look at the image again... you are trying to access action.responseXML which doesn't exist.

    You need to access action.response.responseXML.

  7. #17
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    Hi Dan,
    Thank You very much for all of your wonderful help.
    We got it almost working, except few things.
    We got into the validatefeed method and we get the response values working.
    But when we try to access this.el.unmask,this.hide methods, we get error. I looked in the page to see any el declarations, but didnt find any to assign it to a var.

    Code:
                        if (channel) {
                            // var description = dq.selectValue('description', channel, 'No description available.');
                            this.el.unmask();
                            this.hide();
                            return this.fireEvent('validfeed', {
                            url: url,
                            text: result.responseText
                            });
                        }
    Can you please help me on this too?

  8. #18
    Ext User
    Join Date
    Apr 2008
    Posts
    82
    Vote Rating
    0
    adelphus is on a distinguished road

      0  

    Default


    Hi Dan,
    Thank you very much for all of your helps. It seems we have almost got it working.
    Thank you very much

Thread Participants: 1

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