0
I have the input:
<input id="id_nome" name="nome" type="text" class="form-control input-style" style="text-transform: uppercase" autofocus required>
I have the following function in Jquery:
$(function () {
$('.form').submit(function () {
//serializando os campos do formulário
var dados = jQuery(this).serializeArray();
var obj = dados;
alert(JSON.stringify(obj));
return false;
});
});
Although the data is capitalized in the input, in the JSON that is displayed in Alert it is in minuscule. How do I convert it to uppercase?
Only you apply uppercase in the properties you want, equal here. Something like:
obj.campo = obj.campo.toUpperCase();
– BrTkCa
How is this different from your previous question? https://answall.com/questions/220140/uppercase-input-n%C3%A3o-funciona-em-Document-getelementbyid
– bfavaretto
@bfavaretto the problem is that it converts all json fields to upper case:
{"NAME":"ID","VALUE":""},{"NAME":"NOME","VALUE":"ASDASDA"}
, In Rest the name of the fields is minuscule, so it does not accept. It would have to be like this:[{"name":"id","value":""},{"name":"nome","value":"ASDASDA"}]
– Gleyson Silva