This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// validate the form on submit | |
this.submit( function( event ) { | |
if ( validator.settings.debug ) { | |
// prevent form submit to be able to see console output | |
event.preventDefault(); | |
} | |
function handle() { | |
var hidden; | |
if ( validator.settings.submitHandler ) { | |
if (validator.submitButton) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.extend(options, { | |
type: element.getAttribute("data-ajax-method") || undefined, | |
url: element.getAttribute("data-ajax-url") || undefined, | |
beforeSend: function (xhr) { | |
var result; | |
asyncOnBeforeSend(xhr, method); | |
result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); | |
if (result !== false) { | |
loading.show(duration); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.ComponentModel; | |
using System.ComponentModel.DataAnnotations; | |
namespace Validators | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Web.Json; | |
namespace Web.Filters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace SFR.TOR.Web.Filters | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the submitHandler callback via the settings object, as is necessary if you are using Unobtrusive Validation. | |
// If you are not using Unobtrusive Validation then you can set submitHandler in the options object passed to validate(). | |
$("#iTrentExportForm").validate().settings.submitHandler = function (form) { | |
BlockPage(); // you may want to block the page during the Ajax call | |
var container = $(form).find("[data-valmsg-summary=true]"), | |
list = container.find("ul"); | |
if (list && list.length) { | |
list.empty(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If using Unobtrusive Validation then that library initialised the Validate plugin | |
// on our behalf, so we missed the chance to set invalidHandler. Even if we were to | |
// set invalidHandler now via the settings object it would have no effect, due to the | |
// way that Validate works internally. Instead, we can do the following: | |
$("#MyForm").bind("invalid-form.validate", function () { | |
// Do something useful e.g. display the Validation Summary in a popup dialog | |
$("div.ValSummary").dialog({ | |
title: "Information", | |
modal: true, | |
resizable: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dateTimeReviver (key, value) { | |
var a; | |
if (typeof value === 'string') { | |
a = /\/Date\((\d*)\)\//.exec(value); | |
if (a) { | |
return new Date(+a[1]); | |
} | |
} | |
return value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatDate (d,f){return f.replace(/{(.+?)(?::(.*?))?}/g,function(v,c,p){for(v=d["get"+c]()+/h/.test(c)+"";v.length<p;v=0+v);return v})} | |
// Formats the date as a string e.g. "24/08/2013 17:04" | |
var formattedDate = formatDate(parsedDate, "{Date:2}/{Month:2}/{FullYear} {Hours:2}:{Minutes:2}"); | |
//Instead of using classical format specifiers like "YYYY", "MM", "HH", "mm" etc. | |
//this function uses the Date instance getters like getFullYear, getMonth, etc. | |
//with support for zero-padding. | |
//For example, instead of: |
OlderNewer