in place edit in rails for textbox

794 Views Asked by At

I have an application, in which I have textboxes, how to do in-place edit I tried all, I am getting nothing and I am not able to set up as per guides of GitHub

https://github.com/bootstrap-ruby/bootstrap-editable-rails

https://github.com/janv/rest_in_place

and best_in_place doesn't work for higher rails version

<input type="text" name="<%= 'commit['+ question.id+']' %>" id =        
   "showAnswer" placeholder="Your answer"  class="form-name form-
   control" value = "<%=  [email protected]? ? @tempDisplay.key?
   (question.id) ? @tempDisplay[question.id] :'' : '' %>" 
   style="margin-bottom:4px;">  

 <button name ="btn"  type="button" class="tabledit-edit-button btn 
  btn-sm btn-default"  value = "Save"  onclick='singleSave("<%= 
  question.id %>")'> Save</button>

this is my text field in which I want to apply-in-place edit functionality but how to achieve that functionality without using my Save button as my save button call ajax function and passes parameters to the controller and how to use in_place edit in my text box.As my text acts as to display text also.When the user enters text in the textbox it should become non-textbox and when he/she clicks on it, it becomes editable

How to apply in place edit in my text box, it also send params to the controller as an array via name="<%= 'commit['+ question.id+']' %>"

can anyone tell me how to do that, as I am not able to follow the GitHub instructions as its vague for me

1

There are 1 best solutions below

1
Sumit Dey On

You can try this one very easy to setup and use https://github.com/bernat/best_in_place