This commit is contained in:
2019-07-02 17:22:16 +00:00
parent 54a68e1136
commit 0bbcd5fd3f
3 changed files with 12 additions and 7 deletions

View File

@@ -168,6 +168,9 @@ namespace AyaNova.Biz
var ValidFormFields = FormAvailableFields.FormFields(inObj.FormKey);
try
{
//Parse the json, expecting something like this:
//[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]
//Array at root is valid json and saves a bit of bandwidth so minimal is best
var v = JArray.Parse(inObj.Template);
for (int i = 0; i < v.Count; i++)

View File

@@ -15,7 +15,7 @@ namespace AyaNova.Models
- Hide "hide"
- Required "required"
- Type One of values from AyDataType but not tags or enum (bool, date, date time, decimal, number, picklist(FUTURE), and text)
- e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
- e.g.: [{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]
*/
public partial class FormCustom
@@ -25,7 +25,7 @@ namespace AyaNova.Models
[Required, MaxLength(255)]
public string FormKey { get; set; }//max 255 characters ascii set
public string Template { get; set; }//JSON fragment of form customization template
public string Template { get; set; }//JSON fragment of form customization template, top level is array.
}
}

View File

@@ -79,15 +79,18 @@ namespace AyaNova.Util
//WIDGET sample form customization
{
?? Should the template be an object or an array at the top
//?? Should the template be an object or an array at the top
//In other words is it correct below or in the TEST Project FormCustom code where it's directly an array
//verify what is coming out of the test project in json first before this
//According to the internet (:)) an array or an object is a valid top level json root object so it could go either way and it's a matter of preference I guess
var ct = ServiceProviderProvider.DBContext;
var fc = new FormCustom()
{
FormKey = "widget",
Template = @"{
""template"": [
Template = @"[
{
""fld"": ""WidgetNotes"",
""required"": ""true""
@@ -122,8 +125,7 @@ namespace AyaNova.Util
""required"": ""false"",
""type"": ""decimal""
}
]
}"
]"
};
ct.FormCustom.Add(fc);