Closed aman199002 closed 11 years ago
you need to disable inputs (html attribute disable='disable'), not just hide them.
Don't know how to do that without JS
Closing this issue. This is not related to this gem
This issue is not directly related to gem but with rc bootstrap.I have solved the issue using js by disabling all the inputs for hidden block that are being used for other devices.
=simple_form_for @ticket do |f|
div.row
.hidden-sm.large_screen
.col-9.col-sm-9.col-lg-9
= f.text_field :price
.hidden-lg.mobile_screen
.col-12.col-sm-12.col-lg-12
= f.text_field :price, :style => "height:0.8cm;width:0.8cm;"
= f.submit
The div blocks specified for other devices will remain hidden if page is loaded on a specific device. And we want to skip those elements. So, disabled those if particular div block is hidden, so that multiple parameters will not be passed for same attribute while submitting the form.
In js file
$('div.mobile_screen :input').attr('disabled', true) if $('div.mobile_screen').is(":hidden")
$('div.large_screen :input').attr('disabled', true) if $('div.large_screen').is(":hidden")
Issue Resolved.
I am using rc bootstrap in my rails application. I want to see a form in different style according to devices.For this i am using this code:
But when i edit my record via this form, i receive 2 params[:ticket][:price] records, the input field is only hidden according to device but its value is passed. Is there any way to disable the input-fields according to devices.