I have a Ext JS Window with a spring form of user details. Additionally, I have an user validator in my controller, so that, if the form has errors i can see what errors are:
我有一个Ext JS窗口,其中包含弹簧形式的用户详细信息。另外,我的控制器中有一个用户验证器,因此,如果表单有错误,我可以看到错误是什么:
UserValidator userValidator = new UserValidator();
userValidator.validate(user, result);
if(result.hasErrors()){
return "RegisterUserForm";
My problem is relative to have this form inside a ExtJS window. If i return "RegisterUserForm" the browser goes to this form and show the errors but not in the window. It shows the form and errors in a new page and the url changes to /RegisterUserForm. (This is obvious) How can i show the same form with errors without having this problem?
我的问题是相对于在ExtJS窗口中有这个表单。如果我返回“RegisterUserForm”,浏览器将转到此表单并显示错误,但不会显示在窗口中。它显示新页面中的表单和错误,并且URL更改为/ RegisterUserForm。 (这很明显)如何在没有此问题的情况下显示相同的错误表单?
Thank you
谢谢
1 个解决方案
#1
1
There are 2 options:
有两种选择:
- Change your server code to make that an AJAX call that returns only the data to be handled by your ExtJS code, rather than a form page
- 更改您的服务器代码,使其成为一个AJAX调用,只返回由ExtJS代码处理的数据,而不是表单页面
- Make your
Ext.window.Window
use an iFrame with the/RegisterUserForm
url: - 让你的Ext.window.Window使用带有/ RegisterUserForm url的iFrame:
ex:
例如:
Ext.create('Ext.window.Window', {
layout: 'fit',
//other config here
items: [{
xtype: 'component',
autoEl: {
itemId: 'iframe',
tag: 'iframe',
src: '/RegisterUserForm',
frameBorder: 0
}
}]
}).show()
#1
1
There are 2 options:
有两种选择:
- Change your server code to make that an AJAX call that returns only the data to be handled by your ExtJS code, rather than a form page
- 更改您的服务器代码,使其成为一个AJAX调用,只返回由ExtJS代码处理的数据,而不是表单页面
- Make your
Ext.window.Window
use an iFrame with the/RegisterUserForm
url: - 让你的Ext.window.Window使用带有/ RegisterUserForm url的iFrame:
ex:
例如:
Ext.create('Ext.window.Window', {
layout: 'fit',
//other config here
items: [{
xtype: 'component',
autoEl: {
itemId: 'iframe',
tag: 'iframe',
src: '/RegisterUserForm',
frameBorder: 0
}
}]
}).show()