1
votes

i'm new with ruby and have a question about the execution of ruby files on server side.

So I got this form with a button, when clicked I need to send to the server some user data and return a file to download.

On the server side I have fileExporter.rb and in client side a form using Extjs 4

Ext.create('Ext.form.Panel', {
                        url: 'fileExporter.rb',
                        buttons: [{
                            text: 'Export to file',
                            width: 100,
                            handler: function() {
                                Ext.MessageBox.alert('This is my title','File Exported', function(){
                                  return true;
                                    });
                            }
                        }]
                    });

Surely I'm missing something, I don't know how to execute de ruby file to return the exported file.

thanks in advance.

1

1 Answers

1
votes

What you are searching for, is the form.submit() method.

handler: function(btn) {
    Ext.MessageBox.alert('This is my title','File Exported', function(){
      btn.up('form').submit();
        });
}