Exemple #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);
        }
        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);
        }