mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 14:31:16 +00:00
Fix attribute minLength bug
This commit is contained in:
parent
2dc7d8009d
commit
b1a413becf
@ -20,6 +20,17 @@ class InputCheckboxWithNestedInputs extends React.Component { // eslint-disable-
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.props.handleChange({ target });
|
this.props.handleChange({ target });
|
||||||
|
|
||||||
|
if (!target.value) {
|
||||||
|
const paramsToRemove = {
|
||||||
|
target: {
|
||||||
|
type: 'number',
|
||||||
|
value: '',
|
||||||
|
name: `${this.props.data.name}Value`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
this.props.handleChange(paramsToRemove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ const hasNestedValue = (attributeData) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (get(attributeData.params, ['minValue']) > get(attributeData.params, 'maxValue')) {
|
if (isNumber(get(attributeData.params, 'maxValue')) && get(attributeData.params, ['minValue']) > get(attributeData.params, 'maxValue')) {
|
||||||
formErrors.push({ name: 'params.minValue', errors: [{ id: 'content-type-builder.error.validation.minSupMax' } ] });
|
formErrors.push({ name: 'params.minValue', errors: [{ id: 'content-type-builder.error.validation.minSupMax' } ] });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get(attributeData.params, ['minLengthValue']) > get(attributeData.params, 'maxLengthValue')) {
|
if (isNumber(get(attributeData.params, 'maxLengthValue')) && get(attributeData.params, ['minLengthValue']) > get(attributeData.params, 'maxLengthValue')) {
|
||||||
formErrors.push({ name: 'params.minLengthValue', errors: [{ id: 'content-type-builder.error.validation.minSupMax' } ] });
|
formErrors.push({ name: 'params.minLengthValue', errors: [{ id: 'content-type-builder.error.validation.minSupMax' } ] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ export function* submitChanges(action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
unset(body.attributes[index].params, key);
|
const paramsKey = includes(key, 'Value') ? replace(key,'Value', '') : key;
|
||||||
|
unset(body.attributes[index].params, paramsKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user