public static void HandleSubmit(FormElement form, DomEvent evt, AjaxOptions ajaxOptions) { evt.PreventDefault(); // run validation ArrayList validationCallbacks = (ArrayList)Type.GetField(form, "validationCallbacks"); if (validationCallbacks != null) { for (int i = 0; i < validationCallbacks.Length; i++) { ValidationCallback callback = (ValidationCallback)validationCallbacks[i]; if (!callback()) { return; // bail out since validation failed } } } string body = MvcHelpers.SerializeForm(form); MvcHelpers.AsyncRequest(form.Action, form.Method ?? "post", body, form, ajaxOptions); }
public static void HandleClick(AnchorElement anchor, DomEvent evt, AjaxOptions ajaxOptions) { evt.PreventDefault(); MvcHelpers.AsyncRequest(anchor.Href, "post", "", anchor, ajaxOptions); }
public static void HandleSubmit(FormElement form, DomEvent evt, AjaxOptions ajaxOptions) { evt.PreventDefault(); string body = MvcHelpers.SerializeForm(form); MvcHelpers.AsyncRequest(form.Action, form.Method ?? "post", body, form, ajaxOptions); }
private void Form_OnSubmit(DomEvent e) { FormElement form = (FormElement)e.Target; InputElement submitButton = _submitButtonClicked; if (submitButton != null && (bool)Type.GetField(submitButton, "disableValidation")) { return; // don't perform validation } string[] errorMessages = Validate("submit"); if (!ValidationUtil.ArrayIsNullOrEmpty(errorMessages)) { e.PreventDefault(); // there was an error } }