Beispiel #1
0
        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);
        }
Beispiel #2
0
 public static void HandleClick(AnchorElement anchor, DomEvent evt, AjaxOptions ajaxOptions)
 {
     evt.PreventDefault();
     MvcHelpers.AsyncRequest(anchor.Href,
                             "post",
                             "",
                             anchor,
                             ajaxOptions);
 }
Beispiel #3
0
        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);
        }