We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1778
    • 659 Posts
    Hello

    I'm using Revo2.3.0-dev from Git. I'm developing a Custom Components with CMP's as usual.

    With a grid I have a createWindow (as in Doodles)... But it seems that when I add a listener to a field in my createwindow the listener is fired when the window is loaded... not when the field change (for a 'change' event on a text field for example, or on a 'check' event on a checkbox...
    I'm probably missing something basic but can't find what...

    I call my window with a classic button in a tbar
    text: _(add'),
    handler: {
         xtype: 'create-win',
         blankValues: true
     }  
    


    And I have a very basic textifeld
    columnWidth: .25,
     layout: 'form',
    items: [{
        xtype: 'textfield',
        fieldLabel: 'name',
         anchor: '98%',
        listeners: {
               'change':{fn:console.log('changed'),scope:this} 
         }
     }]
    

    The "console.log('changed')" fires when I click on the button in the toolbar not when the field changes ... I need to intercept event to hide/show some informations/datas depending on filled values...
    Any idea on how to solve that ?

    Cheers [ed. note: anso last edited this post 14 years, 3 months ago.]
      • 33976 ☆ A M B ☆
      • 571 Posts
      Hi Anso,

      Not sure about that one, but since you 'populate' (setValues) the form/field upon loading, could it be that it triggers the change event ?

      My 2 cents wink

      Cheers
        • 1778
        • 659 Posts
        Hi Romain
        Am I populating the form in a CREATE window ? In an update, I'm sure I do, but in a create window, I just create some 'empty' fields (not populated) ?
        Maybe it's due to the fact that the 'create window' extends MODx.Window, I'll try with an Ext.window instead...
        If you have any other idea...
        Cheers

        [EDIT] Does not work with Ext.Window, (it opens the window, but it's empty)... May be I can try listening events on the window itself.... [ed. note: anso last edited this post 14 years, 3 months ago.]
          • 1778
          • 659 Posts
          Shame on me, I knew it was something simple ^_^.... If I write my listener correctly it works fine, how and when it sould !

          listeners: {
             'change': function() { 
                 alert('changed');   
              }         
          }