/// <summary> /// Creates a check box. /// </summary> /// <param name="isChecked"></param> /// <param name="validationMethod">The validation method. Do not pass null.</param> /// <param name="label">Do not pass null.</param> /// <param name="setup">The setup object for the check box.</param> public BlockCheckBox(bool isChecked, Action <PostBackValue <bool>, Validator> validationMethod, string label = "", BlockCheckBoxSetup setup = null) { this.setup = setup ?? new BlockCheckBoxSetup(); checkBoxFormValue = EwfCheckBox.GetFormValue(isChecked, this); this.label = label; action = this.setup.Action ?? FormState.Current.DefaultAction; validation = checkBoxFormValue.CreateValidation(validationMethod); nestedControls = this.setup.NestedControlListGetter != null?this.setup.NestedControlListGetter().ToImmutableArray() : ImmutableArray <Control> .Empty; }
/// <summary> /// Creates a radio button. /// </summary> internal BlockCheckBox( FormValue <CommonCheckBox> formValue, string label, BlockCheckBoxSetup setup, Func <IEnumerable <string> > jsClickHandlerStatementListGetter, EwfValidation validation, string listItemId = null) { radioButtonFormValue = formValue; radioButtonListItemId = listItemId; this.label = label; this.setup = setup; action = setup.Action ?? FormState.Current.DefaultAction; jsClickHandlerStatementLists.Add(jsClickHandlerStatementListGetter); this.validation = validation; nestedControls = setup.NestedControlListGetter != null?setup.NestedControlListGetter().ToImmutableArray() : ImmutableArray <Control> .Empty; }