We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2611
    • 394 Posts
    I notice when i create a new action in system, actions, that the form is cleared
    next time around when i create an action.

    We can NOT get this behaviour, i’ve wandered the internet for hours searching for
    a good solution. I even had the issue with 2.0.0 but now it seems fixed.

    How? How do you guys clear a form smiley

    (No, the form.getForm().reset() doesn’t work)
      Follow me on twitter: @b03tz
      Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
      CodeMaster
      • 17499 ☆ A M B ☆
      • 872 Posts
      This is the right method.

      Do you have access to the form component in your console (console.log(form)) ?
      If yes, can you do the same with form.getForm() and see the available methods ?

      Forms with Extjs are sometimes tricky.
      If your form an id, you can access it too with with finbById(’yourId’).getForm().reset()
        • 2611
        • 394 Posts
        I know but that really doesn’t work. I assign the forms inside a class so basicly:

        this.form = new Ext.form.FormPanel();
        
        // And somewhere else
        this.form.getForm().reset(); // doesn't work
        
          Follow me on twitter: @b03tz
          Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
          CodeMaster
          • 17499 ☆ A M B ☆
          • 872 Posts
          Can you post your class ?
            • 2611
            • 394 Posts
            Sorry for the late reply.

            http://code.google.com/p/visioncart/source/browse/trunk/assets/components/visioncart/mgr/js/page_configuration.js

            If you check out line 215 you can see we were messing around with some "clearform" plugin and also the standard reset
            function.

            It just won’t work...by calling it in the class i cannot have another instance or anything. I am calling the correct
            form.

            Any input??
              Follow me on twitter: @b03tz
              Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
              CodeMaster
              • 21257 MODX Staff
              • 730 Posts
              b03tz: I wonder if you take your tbar handler function and move it outside the scope of the paymentGrid construct, give it a name e.g. function paymentGridTbarHandler() {...} then call it by name in the tbar handler e.g. tbar: paymentGridTbarHandler ..
              It’s been many months since I’ve been in the thick of an extjs app, but I do recall having to do this in certain cases to make sure that functions inside handlers actually executed each time. You might need to look up what parameters are passed to the tbar handler in order to get the right context in your handler function.
              I hope this doesn’t lead you on a wild goose chase, but it’s something to try.
                Mike Schell
                Lead Developer, MODX Cloud
                Email: [email protected]
                GitHub: https://github.com/netProphET/
                Twitter: @mkschell
                • 17499 ☆ A M B ☆
                • 872 Posts
                Sincerely, if all the other method (with getForm()) works, i don’t know.

                If netProphET ideas doesn’t work as well, you should ask Shaun or directly on the Ext forums (even though they are not very helpful).
                  • 28215
                  • 4,149 Posts
                  Hrm, I’m not sure why it’s not working. This code *should* work:

                  this.newModuleForm.getForm().reset();
                  


                  You don’t have any other listeners on that formpanel that are filling it will data after reset() gets called? What’s that code around line 131?

                  this.newModuleForm.getForm().setValues(moduleConfig);
                  this.newModuleWindow.show();
                  
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com