Hi Folks,
I have recently starting working with Flvorful’s Super In Place Controls
(http://os.flvorful.com/super_in_place_controls) and have a question
with which I hope someone can help.
I would like to use either the in_place_select or in_place_radio and
have it display one value, but record another. Without the in place
editing, I might have have used a radio button to display “Active” while
recording “1” in my database (using an integer to record the state
instead of a string, obviously).
The rough code is this (this works correctly in that is displays and
records the status integer correctly):
Status: <%= in_place_select :contestGroup, :status,
:choices => %w(0 1).map {|e| [e,e]} %>
I have been able to use the following some what successfully:
Status: <%= in_place_select :contestGroup, :status,
:choices => {“Disabled” => “0”, “Active” => “1”}.each {|k,v| [k,v]} %>
This will correctly update the database with the new status, but the
display in the select box is either “0” or “1”. If I reverse the hash,
naturally, I see “Disabled” or “Active” in the select box, but then the
string – not the number – is passed back in the AJAX handler.
Finally, I only ever see a “0” or “1” before activating the
in_place_select.
I would greatly appreciate if anyone with some experience with this
plugin and has been able to control the display and update accurately
could share some wisdom.
I’m sure I have simply overlooked something.
Many thanks,
pdp