JsFormValidatorBundle icon indicating copy to clipboard operation
JsFormValidatorBundle copied to clipboard

Issue in collections validation

Open igoryasko31 opened this issue 7 years ago • 2 comments

The issue occurs in the 'addPrototype' method.

var prototype = FpJsFormValidator.preparePrototype( FpJsFormValidator.cloneObject(item.jsFormValidator.prototype), name, item.jsFormValidator.id + '_' + name );

The third parameter of the method 'preparePrototype' is the 'Id' of element + unique index. The method replaces the substring 'name' of the prototype to the third parameter.
As result, the ID contains a duplicate of the substring. The example below: ID (passed as the third parameter): checkout_info_orderItems_0_delegates_1 _ID after 'preparePrototype' calls: checkout_info_orderItems_0_delegates_checkout_info_orderItems_0_delegates_1_phone _

I think the 'preparePrototype' method should get the only unique index as the third parameter. Does it make sense?

igoryasko31 avatar Feb 19 '18 21:02 igoryasko31

Why not? PR are welcome.

66Ton99 avatar Feb 20 '18 12:02 66Ton99

my fix is in https://github.com/shopsys/shopsys/pull/180

It is about replace id to name.

pk16011990 avatar Jun 01 '18 14:06 pk16011990