HtmlForm BuildAuthorForm(){ HtmlForm form = new HtmlForm(){Name="Author", Action="api/Author/save?cayita=true"}; form.Id="form-edit"; form.AddHtmlHiddenField( (field)=>{ field.AddHtmlTextInput((input)=>{ input.Name="Id"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Name"; field.AddHtmlTextInput((input)=>{ input.Required=true; input.Name="Name"; input.Placeholder="Author's name"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="City"; field.AddHtmlTextInput((input)=>{ input.Required=true; input.Name="City"; input.Placeholder="city"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Comments"; field.AddHtmlTextInput((input)=>{ input.Name="Comments"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Active"; field.AddHtmlCheckboxInput((input)=>{ input.Name="Active"; }); }); form.AddActionButton( new HtmlButton(){ Type="submit", Text="Save", Class="button-save btn btn-primary", Name="Author" }); form.AddActionButton( new HtmlButton(){Text="Cancel", Class="button-cancel btn", Name="Author"}); return form; }
HtmlForm BuildUserForm(){ HtmlForm form = new HtmlForm(){Name="User", Action="api/User/save?cayita=true"}; form.Id="form-edit"; form.AddHtmlHiddenField( (field)=>{ field.AddHtmlTextInput((input)=>{ input.Name="Id"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Name"; field.AddHtmlTextInput((input)=>{ input.Required=true; input.Name="Name"; input.Placeholder="User's name"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="City"; field.AddHtmlTextInput((input)=>{ input.Required=true; input.Name="City"; input.Placeholder="city"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Address"; field.AddHtmlTextInput((input)=>{ input.Name="Address"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Birthday"; field.AddHtmlTextInput((input)=>{ input.Name="DoB"; input.Type="date"; input.Required=true; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="E-Mail"; field.AddHtmlTextInput((input)=>{ input.Required=true; input.Name="Email"; input.Placeholder="e-mail"; input.Type="email"; input.Attributes["data-validation-email-message"]="no valid e-mail"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Rating"; field.AddHtmlTextInput((input)=>{ input.Required=true; input.Name="Rating"; input.Placeholder="User's rating"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Level"; field.AddHtmlRadioInput((input)=>{ input.Name="Level"; input.Inline=true; input.Value="A"; input.Label="A"; }); field.AddHtmlRadioInput((input)=>{ input.Name="Level"; input.Inline=true; input.Value="B"; input.Label="B"; }); field.AddHtmlRadioInput((input)=>{ input.Name="Level"; input.Inline=true; input.Value="C"; input.Label="C"; }); }); form.AddHtmlField( (field)=>{ field.Label.InnerHtml="Active"; field.AddHtmlCheckboxInput((input)=>{ input.Name="IsActive"; }); }); form.AddActionButton(b=>{ b.ButtonType=ButtonType.Submit; b.Text="Save"; b.Class="button-save btn btn-primary"; b.Name="User"; }); form.AddActionButton(b=>{ b.Text="Cancel"; b.ButtonType=ButtonType.Reset; b.Class="button-cancel btn"; b.Name="User"; }); return form; }