From 0446e7b6716ea257753191f5885dd734243c4b1f Mon Sep 17 00:00:00 2001 From: Felipe Vieira Date: Tue, 29 Nov 2011 01:31:48 +0000 Subject: [PATCH] adicionando ajax para salvar campos dos formularios --- media/images/loader.gif | Bin 0 -> 2545 bytes .../diagnosticos_categoria_form.js | 44 ++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 media/images/loader.gif create mode 100644 media/js/diagnosticos/diagnosticos_categoria_form.js diff --git a/media/images/loader.gif b/media/images/loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..514a190e91a5edf1cf8c8db6a7617976d7c04d39 GIT binary patch literal 2545 zcma*pYg7~I83*u}xzA)~n25ScZ5t+&C8V$$2v`J#2qX~E6~u*A5kZMuL@tV4gsy=E zNJzp>E`p%pqJjrSP=R^{K^NCmS$C~^PJ4D;{ZQRrj_rO}droU7+Md%7^qhS^&z$%D z&HI0zd14Lv&{Y}Bz%uXy06fpXdGjVdK3<_vgolS4jmD6W5VP5wkdRPPQW6yvm6w;7 zl9J-@@88kUVYAuN($f0-`@v6MK5rx+={6@tuT9VeeV~Rt#20=3PYXWnUU%)U$faj7LUlS*%%Odh|1&S@N5WVFAmR)>UuH zZR+seysp};f>4q~Av05qF}2ouM?;mR1OBvw$7nQj|Mo5lMd>cT;&$vr01vf;obb4a z^ZBO|v$pS0A+#M(XE%*%Xu1lTjx|Iw^u0S521|sQt4Fb1jn6`ab8fa22#7LOWP$CM)&V|O-MTMF82$FgdVF%Z4Gs?~z{hSnXf z0GMwyC```<`4{;SKm|=!w5FFqO;~REm0$>(j`lwv+&@tu&+iqkd^U4@s%}BVq#I$9 zxe=YhK+s@+Gx4m*;rQx7pYDe2fsJUu3xzms%!h;KUT-e8CT7Nx8(JdooJ&wDW8hok z<3~JX4a7$SO3m*tOv@LQx6m}I)RIy>>*F#NvnRg64T}2M6@&?ZfiW!)!leP zfa_243(~V>p{w#*CQRV*T9gxCk30o)Yz5ZmHjB*-}wae z-2K&|JKuKPQZ0xXc4K6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|=n=&CL5`NP!8|E5ijapca(@(M^CO)C8A_amev z0KmllGhywkB48t+2Y}8$I#olVJw#m^G@(J!ZFCO<4Ie|VP4)l`I+rvtTY2R2SfmdK KcMni+*S`U22?;R( literal 0 HcmV?d00001 diff --git a/media/js/diagnosticos/diagnosticos_categoria_form.js b/media/js/diagnosticos/diagnosticos_categoria_form.js new file mode 100644 index 0000000..4835726 --- /dev/null +++ b/media/js/diagnosticos/diagnosticos_categoria_form.js @@ -0,0 +1,44 @@ +// cntabiliza a quantidade de requests +// ajax para nao desabilitar o loader +// antes da hora +var nun_ajax = 0; + +// variaveis globais para as requisicoes +// ajax +$.ajaxSetup({ + url: $(location).attr('href'), + cache: false, + type: 'POST', + dataType: "text", + beforeSend: function() { + nun_ajax++ + $('#working').show() + }, + success: function() { + nun_ajax-- + if (nun_ajax == 0) { + $('#working').hide() + } + }, + error: function(msg) { + $('#working').hide() + //TODO melhorar o tratamento de erro + alert('Ops!\n' + msg); + } +}); + +$(document).ready(function() { + // remove a resposta vazia da interface + $("div.ui-radio span.ui-btn-text:contains('---------')").parentsUntil("ul").hide() + + // para todo input do from registra um evento + // ao modificar o campo + $("div.ui-field-contain input").change(function () { + $.ajax({ + data: { + schema: this.name, + value: this.value + } + }) + }) +});