This commit is contained in:
@@ -56,7 +56,10 @@ todo: child collection items error / rule / customization handling
|
|||||||
where ParentCollectionName is exactly the same as the Model collection property name and
|
where ParentCollectionName is exactly the same as the Model collection property name and
|
||||||
FieldName is exactly the same as the child collection objects Model property name
|
FieldName is exactly the same as the child collection objects Model property name
|
||||||
Update RequiredFieldsValidator to look for these period seperated items and navigate through teh collection by name / reflection to step through children and flag errors to include parent
|
Update RequiredFieldsValidator to look for these period seperated items and navigate through teh collection by name / reflection to step through children and flag errors to include parent
|
||||||
e.g in validation error field name would be "poitems.vendorpartnumber" to indicate poitems collection vendorpartnumber field and set childitems index property (new) to 3 to indicate 4th row (0based)
|
e.g in purchase order record, validation error for not entering required Ordered quantity
|
||||||
|
"target" field name would be "items[0].quantityOrdered" to indicate poitems collection quantityOrdered field and items[0] indicates the first record in the collection
|
||||||
|
Note that this is how the built in validation for Model Required rules operates and that's useful so mirroring it even though it's a little harder to parse it saves a lot of dev time
|
||||||
|
as data annotations will be supported as is
|
||||||
Update ValidationError.cs class, add index property and use it for above
|
Update ValidationError.cs class, add index property and use it for above
|
||||||
Update BizObject.cs add error methods that include index for use with indexed collection item errors
|
Update BizObject.cs add error methods that include index for use with indexed collection item errors
|
||||||
Update client gzform.cs server errors handler to handle indexed child collection like that and report error on row and in popup edit form
|
Update client gzform.cs server errors handler to handle indexed child collection like that and report error on row and in popup edit form
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function getControlLabel(ctrl) {
|
|||||||
// Get errors for a particular field
|
// Get errors for a particular field
|
||||||
// from server error collection
|
// from server error collection
|
||||||
//
|
//
|
||||||
function getErrorsForField(vm, ref) {
|
function getErrorsForField(vm, ref, index) {
|
||||||
//Note: to debug this on forms just put {{ formState.serverError }}
|
//Note: to debug this on forms just put {{ formState.serverError }}
|
||||||
//on the form to see what is actually stored there and should be showing
|
//on the form to see what is actually stored there and should be showing
|
||||||
let ret = [];
|
let ret = [];
|
||||||
@@ -143,9 +143,7 @@ export default {
|
|||||||
if (vm.formState.loading) {
|
if (vm.formState.loading) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// if (ref == "Items.PartId") {
|
|
||||||
// debugger;
|
|
||||||
// }
|
|
||||||
let ctrl = getControl(vm, ref);
|
let ctrl = getControl(vm, ref);
|
||||||
if (typeof ctrl == "undefined") {
|
if (typeof ctrl == "undefined") {
|
||||||
// console.log("gzform:required rule - bailing due to undefined", ref);
|
// console.log("gzform:required rule - bailing due to undefined", ref);
|
||||||
@@ -683,8 +681,6 @@ export default {
|
|||||||
// NOTE: that in a form this should only be used with non stock-required fields, if they are already required they cannot be hidden
|
// NOTE: that in a form this should only be used with non stock-required fields, if they are already required they cannot be hidden
|
||||||
//
|
//
|
||||||
showMe(vm, formCustomTemplateFieldName) {
|
showMe(vm, formCustomTemplateFieldName) {
|
||||||
//TODO: CHILD COLLECTION MOD handle dot notation path indexed collection etc
|
|
||||||
// possibly it will just work since the key will match but double check
|
|
||||||
//special check for wiki field
|
//special check for wiki field
|
||||||
//if read only then can't add any content and if no content then no reason to show it at all
|
//if read only then can't add any content and if no content then no reason to show it at all
|
||||||
if (formCustomTemplateFieldName == "wiki") {
|
if (formCustomTemplateFieldName == "wiki") {
|
||||||
@@ -748,7 +744,6 @@ export default {
|
|||||||
// This is required so that server errors can be cleared when input is changed
|
// This is required so that server errors can be cleared when input is changed
|
||||||
// formReference is an optional string name of the form ref property if alternative named form
|
// formReference is an optional string name of the form ref property if alternative named form
|
||||||
fieldValueChanged(vm, ref, formReference) {
|
fieldValueChanged(vm, ref, formReference) {
|
||||||
//TODO: CHILD COLLECTION MOD add error version for indexed child
|
|
||||||
let that = this;
|
let that = this;
|
||||||
let formControl = null;
|
let formControl = null;
|
||||||
if (formReference == undefined) {
|
if (formReference == undefined) {
|
||||||
@@ -759,7 +754,7 @@ export default {
|
|||||||
|
|
||||||
//dev error on form?
|
//dev error on form?
|
||||||
if (!formControl) {
|
if (!formControl) {
|
||||||
throw `gzform::fieldVAlueChanged formControl is not found ref:${ref}, formReferences:${formReference} `;
|
throw `gzform::fieldValueChanged formControl is not found ref:${ref}, formReferences:${formReference} `;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this is currently required to ensure that this method runs after all the broken rule checks have settled
|
//this is currently required to ensure that this method runs after all the broken rule checks have settled
|
||||||
|
|||||||
@@ -359,6 +359,12 @@
|
|||||||
:label="$ay.t('PurchaseOrderItemQuantityReceived')"
|
:label="$ay.t('PurchaseOrderItemQuantityReceived')"
|
||||||
ref="Items.QuantityReceived"
|
ref="Items.QuantityReceived"
|
||||||
data-cy="Items.QuantityReceived"
|
data-cy="Items.QuantityReceived"
|
||||||
|
:error-messages="
|
||||||
|
form().serverErrors(
|
||||||
|
this,
|
||||||
|
`Items[${editPoItemIndex}].QuantityReceived`
|
||||||
|
)
|
||||||
|
"
|
||||||
:rules="[
|
:rules="[
|
||||||
form().decimalValid(this, 'Items.QuantityReceived'),
|
form().decimalValid(this, 'Items.QuantityReceived'),
|
||||||
form().required(this, 'Items.QuantityReceived')
|
form().required(this, 'Items.QuantityReceived')
|
||||||
@@ -452,6 +458,7 @@
|
|||||||
></v-text-field>
|
></v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
{{ formState.serverError }}
|
||||||
<!-- {{ obj.items[editPoItemIndex] }} -->
|
<!-- {{ obj.items[editPoItemIndex] }} -->
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
|||||||
Reference in New Issue
Block a user