0

What I would like to do is make a hidden form that I can submit using form.submit. I can't use Ext.Ajax.request because I'm also uploading files.

What I have:

function uploadRequest(){
  var hiddenTextField = new Ext.form.TextField({
    id: 'hiddenTextField'
  });

  var gridForm = new Ext.FormPanel({
    id: 'hiddenForm',
    fileUpload: true,
    items: [hiddenTextField]
  });

  hiddenTextField.setValue('Test Value');

  var form = Ext.getCmp('hiddenForm').getForm();
  form.load(); // I want this to load hiddentextfield into the form?
  form.submit({
    url: '/main/grabValue',
    waitMsg: 'Uploading...'
  });
}

This works if instead of form.load() I add in:

var win = new Ext.Window({
  height: 450,
  width: 450,
  closable: true,
  items: [gridForm]
});

//I need something like a form.render that doesn't actually render here.
//hack that renders the form but also makes and shows a completely unnecessary form.
win.show();

How can I use form's built in submit functionality without rendering the form?

4

1 回答 1

1

可以随便放top:-9999px;left:-9999px;吗?许多网站将隐藏的表单字段放在这样的地方来测试垃圾邮件机器人

于 2013-10-18T15:58:51.030 回答