We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40949
    • 20 Posts
    Hey Guys,

    I'm busy with an extra that allows for seperate tablet and mobile content for a template.
    I've got the 3 content fields in one template working, but now I can't get the save button to re-enable onchange.

    Anyone got any idea on how to do that?

    If you're interested in a demo, try viewing http://afstuderen.wercvansterc.nl/ on desktop, tablet and mobile.
    One resource, one template, three content fields within the template.

    Below is a screenshot of the new 'Template' system I'm making.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That would be up to your javascript. Something like
      $('field').change(function() {
        $("input[type=submit]").removeAttr("disabled"); 
      });
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 40949
        • 20 Posts
        That could work Susan, but I was hoping for a modx listener or something, that I can call from ExtJS.

        Something like:
        ,items: [{
            xtype: 'textarea'
            ,fieldLabel: '[Desktop] - '+_('template_code')
            ,name: 'content'
            ,id: 'modx-template-descontent'
            ,anchor: '90%'
            ,height: 400
            ,value: this.getContent('desktop')
            ,listeners: { 'change': function(){ 
                 //re-enable save button here 
             } }
        }]
          • 37110
          • 72 Posts
          The MODx.fireResourceFormChange(); function only works inside the create en update panel of a resource.
          Maybe you could look into the modx.js core files to see if there's a function called MODx.fireTemplateFormChange(); or something like that.

          If the panel on the outside of the buttons has an id you could do:

          Ext.getCmp('idofpanel').item.item[0].enable();

            • 6629
            • 60 Posts
            Just a rough guess... works when executed in js-console.

            Ext.getCmp('modx-panel-template').markDirty();
              • 40949
              • 20 Posts
              Quote from: DasItsch at Sep 04, 2013, 07:56 AM
              Just a rough guess... works when executed in js-console.

              Ext.getCmp('modx-panel-template').markDirty();

              This works! But only if I click outside of the textarea after doing some typing. Which makes sense, as I'm calling it on 'change'.

              'keydown' and 'keyup' don't seem to work though.

              We're halfway there laugh
                • 6629
                • 60 Posts
                You have to add
                ,enableKeyEvents: true
                to your textarea.
                  • 40949
                  • 20 Posts
                  Ah, and that simple addition fixed it.

                  @DasItsch: Thanks for the fast responses