0

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?

Andy
  • 61,948
  • 13
  • 68
  • 95
junior developper
  • 448
  • 2
  • 19
  • 40

1 Answers1

0

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());
});
JeuryInc
  • 79
  • 5