public static MvcHtmlString GovUkPostCodeInputFor <TModel, TProperty>( this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string buttonText = null, bool hideLabel = false, bool hasCustomValidation = false) { var validationAttributes = htmlHelper.GetValidationAttributes(expression); var hasValidation = hasCustomValidation || validationAttributes.Count > 0; var html = new StringBuilder(); html.Append(TextInputHtml.GenerateCustomTextInputFor(htmlHelper, expression, new { @class = "form-control form-control-1-8 post-code" }, validationAttributes)); if (!string.IsNullOrEmpty(buttonText)) { html.Append(string.Format(" <input type=\"submit\" id=\"FindAddress\" name=\"FindAddress\" class=\"button\" value=\"{0}\">", buttonText)); } return(ControlContainerHtml.GenerateSingleContainer( htmlHelper, expression, new MvcHtmlString(html.ToString()), hideLabel, hasValidation)); }
public static MvcHtmlString GovUkCustomTextInputFor <TModel, TProperty>( this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object customFieldAttributes, bool hideLabel = false, bool hasCustomValidation = false) { var validationAttributes = htmlHelper.GetValidationAttributes(expression); var hasValidation = hasCustomValidation || validationAttributes.Count > 0; return(ControlContainerHtml.GenerateSingleContainer( htmlHelper, expression, TextInputHtml.GenerateCustomTextInputFor(htmlHelper, expression, customFieldAttributes, validationAttributes), hideLabel, hasValidation)); }