Umbraco 8 - Umbraco Forms - CustomDatepicker Pikaday problems
Hi,
I have create this new CustomDatePicker class:
public class CustomDatePicker : FieldType
{
[Umbraco.Forms.Core.Attributes.Setting("Placeholder", Alias = "placeholder", Description = "Enter a HTML5 placeholder value", View = "textstring")]
public string Placeholder { get; set; }
public CustomDatePicker()
{
this.Id = new Guid("4c1ff777-0412-43ee-bfe0-53e71b931d74");
this.Name = "CustomDatePicker";
this.Description = "Render a custom datepicker field.";
this.Icon = "icon-calendar";
this.DataType = FieldDataType.DateTime;
this.Category = "Simple";
this.SortOrder = 30;
this.SupportsRegex = true;
// Optional
this.HideField = false;
this.HideLabel = false;
this.FieldTypeViewName = "FieldType.CustomDatePicker.cshtml";
}
// You can do custom validation in here which will occur when the form is submitted.
// Any strings returned will cause the submit to be invalid!
// Where as returning an empty ienumerable of strings will say that it's okay.
public virtual IEnumerable<object> ProcessValue(IEnumerable<object> postedValues)
{
return CustomDatePicker.ProcessFieldValues(postedValues);
}
public override IEnumerable<object> ConvertToRecord(Field field, IEnumerable<object> postedValues, HttpContextBase context)
{
return CustomDatePicker.ProcessFieldValues(postedValues);
}
private static IEnumerable<object> ProcessFieldValues(IEnumerable<object> postedValues)
{
List<object> objectList = new List<object>();
postedValues = (IEnumerable<object>)postedValues.ToArray<object>();
if (!postedValues.Any<object>())
return (IEnumerable<object>)objectList;
DateTime result;
if (DateTime.TryParse(postedValues.First<object>().ToString(), out result))
objectList.Add((object)result);
return (IEnumerable<object>)objectList;
}
}
But I dont got the pikaday function to work. Shall I add some settings for that here or is there anywhere else?
Umbraco 8 - Umbraco Forms - CustomDatepicker Pikaday problems
Hi,
I have create this new CustomDatePicker class:
But I dont got the pikaday function to work. Shall I add some settings for that here or is there anywhere else?
Thanks!
is working on a reply...