diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index b762f534..253f8fae 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index 46200f8c..304b534b 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -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); diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index 342e0eef..bacc2221 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -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