This commit is contained in:
@@ -45,8 +45,14 @@ CURRENT ROADMAP
|
||||
CURRENT TODOs
|
||||
=-=-=-=-=-=-=
|
||||
|
||||
NOW: Happy monday mofo, working on Custom2 biz rule when empty on regular record (not new yet, just getting it working on regular up front)
|
||||
NOW: working on Custom2 biz rule when empty on regular record (not new yet, just getting it working on regular up front)
|
||||
- Currently it always shows the error even when filled, can't seem to show the label name and entering or clearing doesn't seem to get it out of error state
|
||||
- PLAN
|
||||
- Have a dedicated customFieldsRequired() rule in gzform since the only possible rule is required for custom fields
|
||||
- Use the customFieldsRequired() rule for *all* custom fields since it will check the template rules when the rule is run anyway field by field
|
||||
- Have that rule use the current value of customFields which is always the most recent and up to date json fragment, parse it to determine if the field is set or not
|
||||
- Have that rule use the current value of the custom fields template for the form, maybe accessible as a prop or maybe passed on, not sure at this point
|
||||
- for any place in code (ref="item.datakey" rather than current setting) that the actual visible name of the field isn't shown always stick with generic custom field names like c2 rather than WidgetCustom2 to ensure re-usability
|
||||
|
||||
TODO: Make sure can easily make new record in Widget form before getting into deeper stuff or making any other object forms.
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ function getControl(vm, ref) {
|
||||
var customFields = vm.$refs["customFields"];
|
||||
if (customFields !== undefined) {
|
||||
ctrl = customFields.$refs[ref];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,20 +72,28 @@ function getControl(vm, ref) {
|
||||
//
|
||||
function getControlValue(ctrl) {
|
||||
var value = ctrl.value;
|
||||
// if(value==undefined){
|
||||
// debugger;
|
||||
// if(ctrl._props){
|
||||
// var subvalue=ctrl._props;
|
||||
|
||||
// }
|
||||
// }
|
||||
return value;
|
||||
//vm.$refs["customFields"]._computedWatchers.c2.value
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Get field name from control
|
||||
//
|
||||
function getControlLabel(ctrl) {
|
||||
// if (window.$gz.errorHandler.developmentModeShowErrorsImmediately) {
|
||||
// if (!ctrl.label) {
|
||||
// debugger;
|
||||
// throw "gzform:getControlLabel - the control has no label " + ctrl;
|
||||
// }
|
||||
// }
|
||||
return ctrl.label;
|
||||
|
||||
if(ctrl.label==undefined){
|
||||
return "UNKNOWN CONTROL";
|
||||
}else{
|
||||
return ctrl.label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
@@ -142,14 +151,20 @@ function getErrorBoxErrors(vm, errs) {
|
||||
}
|
||||
|
||||
export default {
|
||||
todo: make a customFieldsCheck() rule, see todo.txt top item under "now"
|
||||
///////////////////////////////
|
||||
// REQUIRED
|
||||
//
|
||||
required(vm, ref) {
|
||||
required(vm, ref, subvm) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
}
|
||||
//debugger;
|
||||
|
||||
if(subvm){
|
||||
debugger;
|
||||
console.log("gzform:required() being called from custom fields control: ref=" + ref + " customFields value = " + vm.$refs.customFields.value);
|
||||
|
||||
}
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return false;
|
||||
@@ -159,6 +174,7 @@ export default {
|
||||
if (!isEmpty(value)) {
|
||||
return false;
|
||||
}
|
||||
// console.log("gzform:required() -> Control " + ref + " is empty! returning errror");
|
||||
|
||||
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
|
||||
var err = window.$gz.locale.get("ErrorRequiredFieldEmpty");
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
:label="lt(item.fld)"
|
||||
:ref="item.fld"
|
||||
:error-messages="form().serverErrors(parentVM, item.fld)"
|
||||
:rules="[form().required(parentVM, item.fld)]"
|
||||
:rules="[form().required(parentVM, item.fld, _self)]"
|
||||
auto-grow
|
||||
clearable
|
||||
></v-textarea>
|
||||
@@ -218,7 +218,7 @@ export default {
|
||||
this.$emit("update:value", ret);
|
||||
//this triggers the onchange routine in the parent form
|
||||
//mainly for custom fields purposes so that the dirty checking works
|
||||
this.$emit("change");
|
||||
this.$emit("change",ret);
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
|
||||
@@ -573,6 +573,10 @@ export default {
|
||||
});
|
||||
}
|
||||
}
|
||||
// ,
|
||||
// getCustomFieldValue(fld) {
|
||||
// return this.$refs["customFields"].$refs[fld].$props.value;
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user