cmc-sales/webroot/js/global.js

51 lines
986 B
JavaScript
Raw Normal View History

/**
* Javascript that applies to the whole site.
*
* Apply button() to buttons and submit buttons for jQuery UI styling.
*/
$(function() {
$("button, input:submit").button();
$('#globalAjaxLoading')
.hide() // hide it initially
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
2011-05-18 16:46:22 -07:00
});
});
function getCakeID(model, count, field) {
return model+count+capitalizeFirstLetter(field);
}
function getCakeName(model, count, field) {
return 'data['+model+']['+count+']['+field+']';
}
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function getSelectedID(elementID) {
var id;
$(elementID+" :selected").each(function(i, selected) {
id = this.value;
});
return id;
}
2011-05-18 16:46:22 -07:00
function getSelectedText(elementID) {
var text;
$(elementID+" :selected").each(function(i, selected) {
text = $(selected).text();
});
return text;
}