This may seem like a bit of a silly question, but here's the reason:
I have an app where a large number of options may need to be selected.
Some are simply on/off with a checkbox but others have an additional
text input field associated with them. This is OK if users read the
instructions or they only select an on/off option, but sometimes for the
options with additional text they simply type into the input field and
neglect to tick the box as well. One way around this would be to
re-write the code to remove the requirement for checkboxes on
everything, but before doing that I would like to try using
observe_field to tick the box if they start typing text in the field. Is
that possible?
You could use the JS onblur to enable the check box.
<%= text_field_tag "text","field" :onblur =>
'check_text_field_for_text(this)' %>
then use a js function to check the text box for text and set the
checkbox accordingly.