In your LightSwitch HTML application (Visual Studio 2013) you might want to capitilize each word in a Text Box before saving to a database. This way you can present your data in your reports more uniformly.
3. We use the following code.
myapp.AddEditOpportunity.beforeApplyChanges = function (screen) {
var customer = screen.findContentItem("Customer");
customer.data.Customer = titleCase(customer.value.toString());
};
function titleCase(sentence) {
return sentence.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}