This commit is contained in:
2019-11-26 20:05:32 +00:00
parent 1ebbd6e683
commit dee340b9fa
3 changed files with 19 additions and 13 deletions

View File

@@ -46,14 +46,7 @@ CURRENT TODOs
=-=-=-=-=-=-=
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.
TODO: UI would be greatly enhanced if server defined form customization rules for required fields both Custom and regular were incorporated into client end before roundtripping to the server

View File

@@ -169,8 +169,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");
var fieldName = getControlLabel(ctrl);

View File

@@ -197,17 +197,31 @@ export default {
SetValueForField: function(dataKey, newValue) {
//https://stackoverflow.com/questions/39868963/vue-2-mutating-props-vue-warn
//debugger;
debugger;
//Ok, could end up here with no value set yet at all for the entire custom fields control as it's a new record or something so...
//what are valid values for custom fields on a new record, completely empty?
// if(this.value=== null || this.value===undefined){
// this.value="{\"" + dataKey+"\":null}";
// }
if(this.value=== null || this.value===undefined){
this.value="{}";//empty json fragment
}
//Get the data out of the json string value
//
var cData = JSON.parse(this.value);
if (!window.$gz._.has(cData, dataKey)) {
cData[dataKey]=null;
}
//handle null or undefined
if (newValue === null || newValue === undefined) {
cData[dataKey] = null;
} else {
} else {
//then set item in the cData
//TODO: This will likely need also to be converted because dates and stuff