This commit is contained in:
@@ -168,6 +168,9 @@ namespace AyaNova.Biz
|
|||||||
var ValidFormFields = FormAvailableFields.FormFields(inObj.FormKey);
|
var ValidFormFields = FormAvailableFields.FormFields(inObj.FormKey);
|
||||||
try
|
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);
|
var v = JArray.Parse(inObj.Template);
|
||||||
|
|
||||||
for (int i = 0; i < v.Count; i++)
|
for (int i = 0; i < v.Count; i++)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace AyaNova.Models
|
|||||||
- Hide "hide"
|
- Hide "hide"
|
||||||
- Required "required"
|
- Required "required"
|
||||||
- Type One of values from AyDataType but not tags or enum (bool, date, date time, decimal, number, picklist(FUTURE), and text)
|
- 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
|
public partial class FormCustom
|
||||||
@@ -25,7 +25,7 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
[Required, MaxLength(255)]
|
[Required, MaxLength(255)]
|
||||||
public string FormKey { get; set; }//max 255 characters ascii set
|
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.
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,15 +79,18 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
//WIDGET sample form customization
|
//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
|
//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
|
//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 ct = ServiceProviderProvider.DBContext;
|
||||||
var fc = new FormCustom()
|
var fc = new FormCustom()
|
||||||
{
|
{
|
||||||
FormKey = "widget",
|
FormKey = "widget",
|
||||||
Template = @"{
|
Template = @"[
|
||||||
""template"": [
|
|
||||||
{
|
{
|
||||||
""fld"": ""WidgetNotes"",
|
""fld"": ""WidgetNotes"",
|
||||||
""required"": ""true""
|
""required"": ""true""
|
||||||
@@ -122,8 +125,7 @@ namespace AyaNova.Util
|
|||||||
""required"": ""false"",
|
""required"": ""false"",
|
||||||
""type"": ""decimal""
|
""type"": ""decimal""
|
||||||
}
|
}
|
||||||
]
|
]"
|
||||||
}"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ct.FormCustom.Add(fc);
|
ct.FormCustom.Add(fc);
|
||||||
|
|||||||
Reference in New Issue
Block a user