how to uppercase all the String elements of backbone serialized form

598 Views Asked by At

When i submit a form i send a serialized object to the server. But before sending it i need to uppercase all its input elements.

this is a piece of my code:

submitForm: function(e) {
    e.preventDefault();
    var data = Backbone.Syphon.serialize(this);
    console.log(data);// here i need to uppercase all data elements
    this.trigger("form:submit", data);
},

I need to do this before sending it to thserver and not in the backend. Any solution to suggest?

1

There are 1 best solutions below

0
On

If data is a array of object you need to iterate each object and use the method toUpperCase(), example:

$.each(data, function(index, value){
    console.log(value.toUpperCase());
});