/// <summary> /// Add a form field to the form. /// Intended for creating a form at runtime. /// </summary> /// <param name="formField">The form field to add</param> /// <param name="clearOnSubmit">If the field should be cleared on submission</param> public void AddFormField(AbstractFormField formField, bool clearOnSubmit = false) { fieldConfigs.Add(new FieldConfig() { field = formField, clearOnSubmit = clearOnSubmit }); }
/// <summary> /// Remove a form field from the form. /// Intended for creating a form at runtime. /// </summary> /// <param name="formField">The form field to remove.</param> /// <returns>If the field was removed successfully or if the field was not in the form.</returns> public bool RemoveFormField(AbstractFormField formField) { var fieldConfig = fieldConfigs.FirstOrDefault(config => config.field == formField); return(fieldConfig == null || fieldConfigs.Remove(fieldConfig)); }