Created
January 20, 2015 16:37
-
-
Save luizrobertofreitas/2eeb2587f5bd3d432bb5 to your computer and use it in GitHub Desktop.
Change the default time picker in the af:inputDate popup
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
$(document).ready(function () { | |
var inputDateCurrentId = ''; | |
$("a[id$='idEndDt\\:\\:glyph']").click(function(evt) { | |
inputDateCurrentId = 'idEndDt'; | |
}); | |
$("a[id$='idStartDt\\:\\:glyph']").click(function(evt) { | |
inputDateCurrentId = 'idStartDt'; | |
}); | |
// Overriding open function | |
(function(open) { | |
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { | |
open.call(this, method, url, async, user, pass); | |
if (method == 'POST' || method == 'post') { | |
this.addEventListener("readystatechange", function(event) { | |
if (this.readyState == 4 && this.responseText.indexOf('af_chooseDate') >= 0) { | |
if (!$("input[id$='"+inputDateCurrentId+"\\:\\:content']").val() || $("input[id$='"+inputDateCurrentId+"']").hasClass("p_AFError")) { | |
if (inputDateCurrentId == 'idStartDt') { | |
$("input[id$='"+inputDateCurrentId+"\\:\\:pop\\:\\:dlg\\:\\:cd\\:\\:hs\\:\\:content']").val("00"); | |
$("input[id$='"+inputDateCurrentId+"\\:\\:pop\\:\\:dlg\\:\\:cd\\:\\:ms\\:\\:content']").val("01"); | |
$("input[id$='"+inputDateCurrentId+"\\:\\:pop\\:\\:dlg\\:\\:cd\\:\\:ss\\:\\:content']").val("00"); | |
} | |
else if (inputDateCurrentId == 'idEndDt') { | |
$("input[id$='"+inputDateCurrentId+"\\:\\:pop\\:\\:dlg\\:\\:cd\\:\\:hs\\:\\:content']").val("23"); | |
$("input[id$='"+inputDateCurrentId+"\\:\\:pop\\:\\:dlg\\:\\:cd\\:\\:ms\\:\\:content']").val("59"); | |
$("input[id$='"+inputDateCurrentId+"\\:\\:pop\\:\\:dlg\\:\\:cd\\:\\:ss\\:\\:content']").val("00"); | |
} | |
} | |
} | |
}); | |
} | |
} | |
})(XMLHttpRequest.prototype.open); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment