Plugins 无法验证Shopware后端表单中的字段
我试图通过向我的控制器发送一个点击来验证ExtJs文件中的一个字段。。一切正常,我得到了结果。。但问题是,我无法在代码中获取Plugins 无法验证Shopware后端表单中的字段,plugins,backend,shopware,Plugins,Backend,Shopware,我试图通过向我的控制器发送一个点击来验证ExtJs文件中的一个字段。。一切正常,我得到了结果。。但问题是,我无法在代码中获取me.article,因为它显示为未定义,因此控制器中的逻辑不会按预期返回结果 任何帮助都将不胜感激 注:这仅适用于Shopware v.5.4.6。它适用于Shopware 5.2 Shopware.apps.Article.view.detail.Base.prototype.createLeftElements = function() { var me =
me.article
,因为它显示为未定义,因此控制器中的逻辑不会按预期返回结果
任何帮助都将不胜感激
注:这仅适用于Shopware v.5.4.6。它适用于Shopware 5.2
Shopware.apps.Article.view.detail.Base.prototype.createLeftElements = function() {
var me =this, articleId = null, additionalText = null;
console.log('article', me.article);
if (me.article instanceof Ext.data.Model && me.article.getMainDetail().first() instanceof Ext.data.Model) {
articleId = me.article.getMainDetail().first().get('id');
additionalText = me.article.getMainDetail().first().get('additionalText');
}
me.nameField = Ext.create('Ext.form.field.Text', {
name: 'name',
dataIndex: 'name',
fieldLabel: me.snippets.name,
allowBlank: false,
enableKeyEvents:true,
checkChangeBuffer:700,
labelWidth: 155,
anchor: '100%',
vtype:'remote',
validationUrl: '{url controller="MyController" action="check"}',
validationRequestParam: articleId,
validationErrorMsg: '{s name=detail/base/number_validation}Validation Message.{/s}'
});
// .. some code here which is irrelevant
return [
me.supplierCombo,
me.nameField,
me.mainDetailAdditionalText,
me.numberField,
{
xtype: 'checkbox',
name: 'active',
fieldLabel: me.snippets.active,
inputValue: true,
uncheckedValue:false
},
{
xtype: 'checkbox',
name: 'isConfigurator',
fieldLabel: me.snippets.configurator.fieldLabel,
inputValue: true,
uncheckedValue:false
}
];
};
我对ExtJS不太了解,但可能是CSRF保护导致了这个问题?也许您需要将控制器列入白名单
不,我不认为这是一个问题,因为我可以看到我的控制器方法在“网络”选项卡中被调用。无论如何,我找到了另一种验证方法,通过直接在控制器中挂接save方法,而不是调用我的验证控制器。