grails - Remove data from disabled input -


"postprint" itemprop = "text">

I have a field that I have disabled in html and sent a request through ajax for a controller, in the field Not accompanied by request, but it is still present in beans.

How can I manage to remove it from the bees automatically?

SimpleController

  Defupacacao Systems Configurationuracao Systems Vista {if (configuracaoSistemaInstance == null) {notFound () return} if (configuracaoSistemaInstance.hasErrors ()) { Reply to configuracaoSistemaInstance.errors, see: 'index' return} configuracaoSistemaInstance.save flush: true request.withFormat {form multipartForm {flash.message = message (code: 'default.updated.message', arg: [message: 'ConfiguracaoSistema.label', default: 'ConfiguracaoSistema'), '']) redirect action: "index"} '*' {configured configurable systema instant, [status: OK]}}}   

H SP I have a field 'that I'll sleep with jQuery

  & lt; Six text field names = "enderecoServicosCatix" class = "form control input catix" disabled = "$ {show}" value = "$ {configuracaoSistemaInstance .enderecoServicosCatix}" />  

After this I disable it via JQuery

  $ ('.catix'). Each (function () {$ (this) .attr ("disabled", correct); $ (this) .prop ('disabled', true;)});  

I send a request to the administrator, I want the saved example to be "nonsensical" bus disabled in the area, but keep this last value.

One way to do this is to do this. Restore the original value when disabling the fields. The original value can be stored as a data attribute of the input field or in hidden fields.

Add a data attribute to your input element to store the original input:

  & lt; Six text field name = "enderecoServicosCatix" class = "form control input catix" disabled = "$ {show}" data-originalvalue = "$ {? ConfiguracaoSistemaInstance .enderecoServicosCatix}" value = "$ {configuracaoSistemaInstance?. EnderecoServicosCatix}" / & Gt;  

Then when restoring the original values.

  $ ( '. Catix') each (function () {$ (this) .attr ($ (this) Kprop ( "disabled", true); $ (this). Vll ($ (this) .attr ( 'data-price'));};  

(I have not tested.)


another way would be a new parameter to make and will instruct to have to pass it to ignore it all "Ktksiks" input new parameters hidden field like this when you are bound to get data from view. for your controller:

  & l t; g: hidden name = "catix_disabled" value = "false" / & gt;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -