extend checkbox data type and mandatory requirement
I am trying to create check box control field data type from contour check box and having problem with Mandatory field set up.
When i add this new data type on form with Mandatory requirement ON - i get this below error when i try to run the form which has this control.
Control 'b1998910_dd75_4dc2_bf58_563b5779dfca' referenced by the ControlToValidate property of 'mandatory' cannot be validated.
This is my full code for the extension. Please help. Thanks in advance.
namespace CheckedCheckBox.FieldType { public class CheckedCheckBox : Umbraco.Forms.Core.FieldType { public Control.CheckedCheckBox chkCheckBox; public List<Object> Value;
public CheckedCheckBox() { Id = new Guid("1A78EF46-E782-461C-AA6B-E6C30D9746B9");
Name = "Check box - default Checked"; Description = "Check box with default checked";
extend checkbox data type and mandatory requirement
I am trying to create check box control field data type from contour check box and having problem with Mandatory field set up.
When i add this new data type on form with Mandatory requirement ON - i get this below error when i try to run the form which has this control.
Control 'b1998910_dd75_4dc2_bf58_563b5779dfca' referenced by the ControlToValidate property of 'mandatory' cannot be validated.
This is my full code for the extension. Please help. Thanks in advance.
namespace CheckedCheckBox.FieldType
{
public class CheckedCheckBox : Umbraco.Forms.Core.FieldType
{
public Control.CheckedCheckBox chkCheckBox;
public List<Object> Value;
public CheckedCheckBox()
{
Id = new Guid("1A78EF46-E782-461C-AA6B-E6C30D9746B9");
Name = "Check box - default Checked";
Description = "Check box with default checked";
Icon = "checkbox.png";
DataType = FieldDataType.Bit;
chkCheckBox = new Control.CheckedCheckBox();
Value = new List<object>();
}
public override WebControl Editor
{
get
{
return chkCheckBox;
}
set { base.Editor = value; }
}
public override List<Object> Values
{
get
{
if (chkCheckBox.Checked)
{
Value.Clear();
Value.Add(true);
}
else
{
Value.Clear();
Value.Add(false);
}
return Value;
}
set { Value = value; }
}
public override string RenderPreview()
{
return "<INPUT TYPE=\"checkbox\" id=\"check-CheckBox\" checked />";
}
public override string RenderPreviewWithPrevalues(List<object> prevalues)
{
return RenderPreview();
}
public override bool SupportsRegex
{
get { return true; }
}
}
}
is working on a reply...