public static void CreateForm(jQuery container, Form template) { foreach (FormField field in template.Fields) { container.Append(App.CreateFormField(field)); } container.Append(new jQuery("<div>") .AddClass("form-group") .Append(new jQuery("<div>") .AddClass("col-sm-offset-2 col-sm-10") .Append(new jQuery(new InputElement { Type = InputType.Submit, Value = "Submit", ClassName = "btn btn-primary", FormAction = SUBMIT_URL, FormMethod = "POST" })) ) ); }
public static void Main() { // fetch form template from http handler and start building form jQuery.Ajax( new AjaxOptions() { Url = App.FORM_TEMPLATE_DATA, Cache = false, Success = delegate(object data, string str, jqXHR jqXHR) { Form template = new Form(data); App.CreateForm(jQuery.Select(FORM_CONTAINER), template); } } ); }