Update JQuery Form to version 3.50
This commit is contained in:
parent
4997dd49fb
commit
a3d5e42183
@ -324,7 +324,7 @@ class SaisieController extends Zend_Controller_Action
|
|||||||
{
|
{
|
||||||
$this->view->headScript()
|
$this->view->headScript()
|
||||||
->appendFile('/themes/default/scripts/saisie.js', 'text/javascript')
|
->appendFile('/themes/default/scripts/saisie.js', 'text/javascript')
|
||||||
->appendFile('/libs/form/jquery.form.js', 'text/javascript');
|
->appendFile('/libs/form/jquery.form.min.js', 'text/javascript');
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$siret = $request->getParam('siret');
|
$siret = $request->getParam('siret');
|
||||||
@ -1003,7 +1003,7 @@ class SaisieController extends Zend_Controller_Action
|
|||||||
//Affichage formulaire
|
//Affichage formulaire
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->view->inlineScript()->appendFile('/libs/form/jquery.form.js');
|
$this->view->inlineScript()->appendFile('/libs/form/jquery.form.min.js');
|
||||||
if ( intval($siren)==0 ) {
|
if ( intval($siren)==0 ) {
|
||||||
$session = new Scores_Session_Entreprise();
|
$session = new Scores_Session_Entreprise();
|
||||||
$siren = '';
|
$siren = '';
|
||||||
|
@ -16,23 +16,22 @@ Fichier PDF : <input type="file" name="fichier" />
|
|||||||
<input type="submit" name="upload" value="Valider" />
|
<input type="submit" name="upload" value="Valider" />
|
||||||
</form>
|
</form>
|
||||||
<div id="uploadOutput"></div>
|
<div id="uploadOutput"></div>
|
||||||
<script type="text/javascript" src="/libs/form/jquery.form.js">
|
<script type="text/javascript" src="/libs/form/jquery.form.min.js"/>
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
var timer;
|
var timer;
|
||||||
|
|
||||||
function checkProgress() {
|
function checkProgress() {
|
||||||
$.getJSON('<?=$this->url(array('controller'=>'dashboard', 'action'=>'newprogress'))?>',
|
$.getJSON('<?=$this->url(array('controller'=>'dashboard', 'action'=>'newprogress'))?>',
|
||||||
{key: $('#key').val()}, function(data) {
|
{key: $('#key').val()}, function(data) {
|
||||||
$('#uploadOutput').html(data.current+'/'+data.total);
|
$('#uploadOutput').html(data.current+'/'+data.total);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#uploadForm').ajaxForm({
|
$('#uploadForm').ajaxForm({
|
||||||
beforeSubmit: function() {
|
beforeSubmit: function() {
|
||||||
$('#uploadOutput').html('Envoi en cours...');
|
$('#uploadOutput').html('Envoi en cours...');
|
||||||
timer = setInterval(checkProgress,500);
|
timer = setInterval(checkProgress,500);
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="/libs/form/jquery.form.js"></script>
|
<script type="text/javascript" src="/libs/form/jquery.form.min.js"/>
|
||||||
<script>
|
<script>
|
||||||
$('#uploadForm').ajaxForm({
|
$('#uploadForm').ajaxForm({
|
||||||
beforeSubmit: function() {
|
beforeSubmit: function() {
|
||||||
|
@ -41,7 +41,7 @@ Votre fichier : <input type="file" name="fichier" />
|
|||||||
</form>
|
</form>
|
||||||
<div id="progressbar"></div>
|
<div id="progressbar"></div>
|
||||||
<div id="uploadOutput"></div>
|
<div id="uploadOutput"></div>
|
||||||
<script type="text/javascript" src="/libs/form/jquery.form.js" />
|
<script type="text/javascript" src="/libs/form/jquery.form.min.js"/>
|
||||||
<script>
|
<script>
|
||||||
$('#uploadForm').ajaxForm({
|
$('#uploadForm').ajaxForm({
|
||||||
beforeSubmit: function() {
|
beforeSubmit: function() {
|
||||||
|
@ -85,7 +85,7 @@ $('select[name="even[]"]').change(function(){
|
|||||||
|
|
||||||
<?php }?>
|
<?php }?>
|
||||||
|
|
||||||
<script type="text/javascript" src="/libs/form/jquery.form.js"></script>
|
<script type="text/javascript" src="/libs/form/jquery.form.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$('form#saisie').bind('submit', function(){
|
$('form#saisie').bind('submit', function(){
|
||||||
var options = {
|
var options = {
|
||||||
|
@ -97,7 +97,7 @@ Liste des documents Infogreffe
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/libs/form/jquery.form.js"></script>
|
<script type="text/javascript" src="/libs/form/jquery.form.min.js"/>
|
||||||
<script>
|
<script>
|
||||||
$.datepicker.setDefaults( $.datepicker.regional["fr"] );
|
$.datepicker.setDefaults( $.datepicker.regional["fr"] );
|
||||||
$('input[name=fileDate]').datepicker({ changeMonth: true, changeYear: true });
|
$('input[name=fileDate]').datepicker({ changeMonth: true, changeYear: true });
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* jQuery Form Plugin
|
* jQuery Form Plugin
|
||||||
* version: 3.46.0-2013.11.21
|
* version: 3.50.0-2014.02.05
|
||||||
* Requires jQuery v1.5 or later
|
* Requires jQuery v1.5 or later
|
||||||
* Copyright (c) 2013 M. Alsup
|
* Copyright (c) 2013 M. Alsup
|
||||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||||
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
// AMD support
|
// AMD support
|
||||||
(function (factory) {
|
(function (factory) {
|
||||||
|
"use strict";
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
// using AMD; register as anon module
|
// using AMD; register as anon module
|
||||||
define(['jquery'], factory);
|
define(['jquery'], factory);
|
||||||
@ -75,11 +76,13 @@ var hasProp = !!$.fn.prop;
|
|||||||
// contains inputs with names like "action" or "method"; in those
|
// contains inputs with names like "action" or "method"; in those
|
||||||
// cases "prop" returns the element
|
// cases "prop" returns the element
|
||||||
$.fn.attr2 = function() {
|
$.fn.attr2 = function() {
|
||||||
if ( ! hasProp )
|
if ( ! hasProp ) {
|
||||||
return this.attr.apply(this, arguments);
|
return this.attr.apply(this, arguments);
|
||||||
|
}
|
||||||
var val = this.prop.apply(this, arguments);
|
var val = this.prop.apply(this, arguments);
|
||||||
if ( ( val && val.jquery ) || typeof val === 'string' )
|
if ( ( val && val.jquery ) || typeof val === 'string' ) {
|
||||||
return val;
|
return val;
|
||||||
|
}
|
||||||
return this.attr.apply(this, arguments);
|
return this.attr.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -257,8 +260,9 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
$form.removeData('jqxhr').data('jqxhr', jqxhr);
|
$form.removeData('jqxhr').data('jqxhr', jqxhr);
|
||||||
|
|
||||||
// clear element array
|
// clear element array
|
||||||
for (var k=0; k < elements.length; k++)
|
for (var k=0; k < elements.length; k++) {
|
||||||
elements[k] = null;
|
elements[k] = null;
|
||||||
|
}
|
||||||
|
|
||||||
// fire 'notify' event
|
// fire 'notify' event
|
||||||
this.trigger('form-submit-notify', [this, options]);
|
this.trigger('form-submit-notify', [this, options]);
|
||||||
@ -290,9 +294,11 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
|
|
||||||
if (options.extraData) {
|
if (options.extraData) {
|
||||||
var serializedData = deepSerialize(options.extraData);
|
var serializedData = deepSerialize(options.extraData);
|
||||||
for (i=0; i < serializedData.length; i++)
|
for (i=0; i < serializedData.length; i++) {
|
||||||
if (serializedData[i])
|
if (serializedData[i]) {
|
||||||
formdata.append(serializedData[i][0], serializedData[i][1]);
|
formdata.append(serializedData[i][0], serializedData[i][1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options.data = null;
|
options.data = null;
|
||||||
@ -327,12 +333,15 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
var beforeSend = s.beforeSend;
|
var beforeSend = s.beforeSend;
|
||||||
s.beforeSend = function(xhr, o) {
|
s.beforeSend = function(xhr, o) {
|
||||||
//Send FormData() provided by user
|
//Send FormData() provided by user
|
||||||
if (options.formData)
|
if (options.formData) {
|
||||||
o.data = options.formData;
|
o.data = options.formData;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
o.data = formdata;
|
o.data = formdata;
|
||||||
if(beforeSend)
|
}
|
||||||
|
if(beforeSend) {
|
||||||
beforeSend.call(this, xhr, o);
|
beforeSend.call(this, xhr, o);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return $.ajax(s);
|
return $.ajax(s);
|
||||||
}
|
}
|
||||||
@ -351,10 +360,12 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
// ensure that every serialized input is still enabled
|
// ensure that every serialized input is still enabled
|
||||||
for (i=0; i < elements.length; i++) {
|
for (i=0; i < elements.length; i++) {
|
||||||
el = $(elements[i]);
|
el = $(elements[i]);
|
||||||
if ( hasProp )
|
if ( hasProp ) {
|
||||||
el.prop('disabled', false);
|
el.prop('disabled', false);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
el.removeAttr('disabled');
|
el.removeAttr('disabled');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,10 +375,12 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
if (s.iframeTarget) {
|
if (s.iframeTarget) {
|
||||||
$io = $(s.iframeTarget);
|
$io = $(s.iframeTarget);
|
||||||
n = $io.attr2('name');
|
n = $io.attr2('name');
|
||||||
if (!n)
|
if (!n) {
|
||||||
$io.attr2('name', id);
|
$io.attr2('name', id);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
id = n;
|
id = n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
|
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
|
||||||
@ -399,12 +412,15 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
|
|
||||||
$io.attr('src', s.iframeSrc); // abort op in progress
|
$io.attr('src', s.iframeSrc); // abort op in progress
|
||||||
xhr.error = e;
|
xhr.error = e;
|
||||||
if (s.error)
|
if (s.error) {
|
||||||
s.error.call(s.context, xhr, e, status);
|
s.error.call(s.context, xhr, e, status);
|
||||||
if (g)
|
}
|
||||||
|
if (g) {
|
||||||
$.event.trigger("ajaxError", [xhr, s, e]);
|
$.event.trigger("ajaxError", [xhr, s, e]);
|
||||||
if (s.complete)
|
}
|
||||||
|
if (s.complete) {
|
||||||
s.complete.call(s.context, xhr, e);
|
s.complete.call(s.context, xhr, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -491,7 +507,10 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||||
function doSubmit() {
|
function doSubmit() {
|
||||||
// make sure form attrs are set
|
// make sure form attrs are set
|
||||||
var t = $form.attr2('target'), a = $form.attr2('action');
|
var t = $form.attr2('target'),
|
||||||
|
a = $form.attr2('action'),
|
||||||
|
mp = 'multipart/form-data',
|
||||||
|
et = $form.attr('enctype') || $form.attr('encoding') || mp;
|
||||||
|
|
||||||
// update form attrs in IE friendly way
|
// update form attrs in IE friendly way
|
||||||
form.setAttribute('target',id);
|
form.setAttribute('target',id);
|
||||||
@ -520,14 +539,16 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
try {
|
try {
|
||||||
var state = getDoc(io).readyState;
|
var state = getDoc(io).readyState;
|
||||||
log('state = ' + state);
|
log('state = ' + state);
|
||||||
if (state && state.toLowerCase() == 'uninitialized')
|
if (state && state.toLowerCase() == 'uninitialized') {
|
||||||
setTimeout(checkState,50);
|
setTimeout(checkState,50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
log('Server abort: ' , e, ' (', e.name, ')');
|
log('Server abort: ' , e, ' (', e.name, ')');
|
||||||
cb(SERVER_ABORT);
|
cb(SERVER_ABORT);
|
||||||
if (timeoutHandle)
|
if (timeoutHandle) {
|
||||||
clearTimeout(timeoutHandle);
|
clearTimeout(timeoutHandle);
|
||||||
|
}
|
||||||
timeoutHandle = undefined;
|
timeoutHandle = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,10 +577,12 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
// add iframe to doc and submit the form
|
// add iframe to doc and submit the form
|
||||||
$io.appendTo('body');
|
$io.appendTo('body');
|
||||||
}
|
}
|
||||||
if (io.attachEvent)
|
if (io.attachEvent) {
|
||||||
io.attachEvent('onload', cb);
|
io.attachEvent('onload', cb);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
io.addEventListener('load', cb, false);
|
io.addEventListener('load', cb, false);
|
||||||
|
}
|
||||||
setTimeout(checkState,15);
|
setTimeout(checkState,15);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -573,6 +596,7 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
finally {
|
finally {
|
||||||
// reset attrs and remove "extra" input elements
|
// reset attrs and remove "extra" input elements
|
||||||
form.setAttribute('action',a);
|
form.setAttribute('action',a);
|
||||||
|
form.setAttribute('enctype', et); // #380
|
||||||
if(t) {
|
if(t) {
|
||||||
form.setAttribute('target', t);
|
form.setAttribute('target', t);
|
||||||
} else {
|
} else {
|
||||||
@ -614,13 +638,16 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
|
|
||||||
if (!doc || doc.location.href == s.iframeSrc) {
|
if (!doc || doc.location.href == s.iframeSrc) {
|
||||||
// response not received yet
|
// response not received yet
|
||||||
if (!timedOut)
|
if (!timedOut) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (io.detachEvent)
|
if (io.detachEvent) {
|
||||||
io.detachEvent('onload', cb);
|
io.detachEvent('onload', cb);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
io.removeEventListener('load', cb, false);
|
io.removeEventListener('load', cb, false);
|
||||||
|
}
|
||||||
|
|
||||||
var status = 'success', errMsg;
|
var status = 'success', errMsg;
|
||||||
try {
|
try {
|
||||||
@ -647,8 +674,9 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
var docRoot = doc.body ? doc.body : doc.documentElement;
|
var docRoot = doc.body ? doc.body : doc.documentElement;
|
||||||
xhr.responseText = docRoot ? docRoot.innerHTML : null;
|
xhr.responseText = docRoot ? docRoot.innerHTML : null;
|
||||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||||
if (isXml)
|
if (isXml) {
|
||||||
s.dataType = 'xml';
|
s.dataType = 'xml';
|
||||||
|
}
|
||||||
xhr.getResponseHeader = function(header){
|
xhr.getResponseHeader = function(header){
|
||||||
var headers = {'content-type': s.dataType};
|
var headers = {'content-type': s.dataType};
|
||||||
return headers[header.toLowerCase()];
|
return headers[header.toLowerCase()];
|
||||||
@ -711,42 +739,52 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
|
|
||||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
if (s.success)
|
if (s.success) {
|
||||||
s.success.call(s.context, data, 'success', xhr);
|
s.success.call(s.context, data, 'success', xhr);
|
||||||
|
}
|
||||||
deferred.resolve(xhr.responseText, 'success', xhr);
|
deferred.resolve(xhr.responseText, 'success', xhr);
|
||||||
if (g)
|
if (g) {
|
||||||
$.event.trigger("ajaxSuccess", [xhr, s]);
|
$.event.trigger("ajaxSuccess", [xhr, s]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (status) {
|
else if (status) {
|
||||||
if (errMsg === undefined)
|
if (errMsg === undefined) {
|
||||||
errMsg = xhr.statusText;
|
errMsg = xhr.statusText;
|
||||||
if (s.error)
|
}
|
||||||
|
if (s.error) {
|
||||||
s.error.call(s.context, xhr, status, errMsg);
|
s.error.call(s.context, xhr, status, errMsg);
|
||||||
|
}
|
||||||
deferred.reject(xhr, 'error', errMsg);
|
deferred.reject(xhr, 'error', errMsg);
|
||||||
if (g)
|
if (g) {
|
||||||
$.event.trigger("ajaxError", [xhr, s, errMsg]);
|
$.event.trigger("ajaxError", [xhr, s, errMsg]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g)
|
if (g) {
|
||||||
$.event.trigger("ajaxComplete", [xhr, s]);
|
$.event.trigger("ajaxComplete", [xhr, s]);
|
||||||
|
}
|
||||||
|
|
||||||
if (g && ! --$.active) {
|
if (g && ! --$.active) {
|
||||||
$.event.trigger("ajaxStop");
|
$.event.trigger("ajaxStop");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.complete)
|
if (s.complete) {
|
||||||
s.complete.call(s.context, xhr, status);
|
s.complete.call(s.context, xhr, status);
|
||||||
|
}
|
||||||
|
|
||||||
callbackProcessed = true;
|
callbackProcessed = true;
|
||||||
if (s.timeout)
|
if (s.timeout) {
|
||||||
clearTimeout(timeoutHandle);
|
clearTimeout(timeoutHandle);
|
||||||
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (!s.iframeTarget)
|
if (!s.iframeTarget) {
|
||||||
$io.remove();
|
$io.remove();
|
||||||
else //adding else to clean up existing iframe response.
|
}
|
||||||
|
else { //adding else to clean up existing iframe response.
|
||||||
$io.attr('src', s.iframeSrc);
|
$io.attr('src', s.iframeSrc);
|
||||||
|
}
|
||||||
xhr.responseXML = null;
|
xhr.responseXML = null;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
@ -774,8 +812,9 @@ $.fn.ajaxSubmit = function(options) {
|
|||||||
data = xml ? xhr.responseXML : xhr.responseText;
|
data = xml ? xhr.responseXML : xhr.responseText;
|
||||||
|
|
||||||
if (xml && data.documentElement.nodeName === 'parsererror') {
|
if (xml && data.documentElement.nodeName === 'parsererror') {
|
||||||
if ($.error)
|
if ($.error) {
|
||||||
$.error('parsererror');
|
$.error('parsererror');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s && s.dataFilter) {
|
if (s && s.dataFilter) {
|
||||||
data = s.dataFilter(data, type);
|
data = s.dataFilter(data, type);
|
||||||
@ -907,8 +946,23 @@ $.fn.formToArray = function(semantic, elements) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var form = this[0];
|
var form = this[0];
|
||||||
|
var formId = this.attr('id');
|
||||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||||
if (!els) {
|
var els2;
|
||||||
|
|
||||||
|
if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
|
||||||
|
els = $(els).get(); // convert to standard array
|
||||||
|
}
|
||||||
|
|
||||||
|
// #386; account for inputs outside the form which use the 'form' attribute
|
||||||
|
if ( formId ) {
|
||||||
|
els2 = $(':input[form=' + formId + ']').get();
|
||||||
|
if ( els2.length ) {
|
||||||
|
els = (els || []).concat(els2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!els || !els.length) {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -931,15 +985,17 @@ $.fn.formToArray = function(semantic, elements) {
|
|||||||
|
|
||||||
v = $.fieldValue(el, true);
|
v = $.fieldValue(el, true);
|
||||||
if (v && v.constructor == Array) {
|
if (v && v.constructor == Array) {
|
||||||
if (elements)
|
if (elements) {
|
||||||
elements.push(el);
|
elements.push(el);
|
||||||
|
}
|
||||||
for(j=0, jmax=v.length; j < jmax; j++) {
|
for(j=0, jmax=v.length; j < jmax; j++) {
|
||||||
a.push({name: n, value: v[j]});
|
a.push({name: n, value: v[j]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (feature.fileapi && el.type == 'file') {
|
else if (feature.fileapi && el.type == 'file') {
|
||||||
if (elements)
|
if (elements) {
|
||||||
elements.push(el);
|
elements.push(el);
|
||||||
|
}
|
||||||
var files = el.files;
|
var files = el.files;
|
||||||
if (files.length) {
|
if (files.length) {
|
||||||
for (j=0; j < files.length; j++) {
|
for (j=0; j < files.length; j++) {
|
||||||
@ -952,8 +1008,9 @@ $.fn.formToArray = function(semantic, elements) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (v !== null && typeof v != 'undefined') {
|
else if (v !== null && typeof v != 'undefined') {
|
||||||
if (elements)
|
if (elements) {
|
||||||
elements.push(el);
|
elements.push(el);
|
||||||
|
}
|
||||||
a.push({name: n, value: v, type: el.type, required: el.required});
|
a.push({name: n, value: v, type: el.type, required: el.required});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1049,10 +1106,12 @@ $.fn.fieldValue = function(successful) {
|
|||||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (v.constructor == Array)
|
if (v.constructor == Array) {
|
||||||
$.merge(val, v);
|
$.merge(val, v);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
val.push(v);
|
val.push(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
@ -1086,7 +1145,7 @@ $.fieldValue = function(el, successful) {
|
|||||||
if (op.selected) {
|
if (op.selected) {
|
||||||
var v = op.value;
|
var v = op.value;
|
||||||
if (!v) { // extra pain for IE...
|
if (!v) { // extra pain for IE...
|
||||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
|
||||||
}
|
}
|
||||||
if (one) {
|
if (one) {
|
||||||
return v;
|
return v;
|
||||||
@ -1142,8 +1201,9 @@ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
|
|||||||
// $('#myForm').clearForm('.special:hidden')
|
// $('#myForm').clearForm('.special:hidden')
|
||||||
// the above would clean hidden inputs that have the class of 'special'
|
// the above would clean hidden inputs that have the class of 'special'
|
||||||
if ( (includeHidden === true && /hidden/.test(t)) ||
|
if ( (includeHidden === true && /hidden/.test(t)) ||
|
||||||
(typeof includeHidden == 'string' && $(this).is(includeHidden)) )
|
(typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1202,8 +1262,9 @@ $.fn.ajaxSubmit.debug = false;
|
|||||||
|
|
||||||
// helper fn for console logging
|
// helper fn for console logging
|
||||||
function log() {
|
function log() {
|
||||||
if (!$.fn.ajaxSubmit.debug)
|
if (!$.fn.ajaxSubmit.debug) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
||||||
if (window.console && window.console.log) {
|
if (window.console && window.console.log) {
|
||||||
window.console.log(msg);
|
window.console.log(msg);
|
||||||
|
7
public/libs/form/jquery.form.min.js
vendored
Normal file
7
public/libs/form/jquery.form.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user