CC-2791: limiting length and numeric with javascript

- done
This commit is contained in:
James 2011-09-13 15:21:23 -04:00
parent 3f13810c0e
commit 750482474f
1 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,16 @@ function hideForShoutcast(ele){
restrictOggBitrate(ele, false)
}
function validate(ele,evt) {
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
if ((ele.val().length >= 5 || (key < 48 || key > 57)) && !(key == 8 || key == 9 || key == 13 || key == 37 || key == 39 || key == 46)) {
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
function showForIcecast(ele){
var div = ele.closest("div")
div.find("#outputMountpoint-label").show()
@ -69,6 +79,10 @@ $(document).ready(function() {
rebuildStreamURL($(this))
})
$("input:[id$=-port]").keypress(function(e){
validate($(this),e)
})
$("select:[id$=-output]").change(function(){
rebuildStreamURL($(this))
})