I have a form on which I need to arrange an input field for entering a comment (type string) or select from predefined comments (select fields). How i can do this? Can i write comment into select field from keyboard and save it in db?
Asked
Active
Viewed 122 times
2 Answers
0
There are two ways to do this
- You can use
[simple_enum][1]
gem to predefined all comment values and then render it in view. [1]: https://rubygems.org/gems/simple_enum - You can create one table and save all the predefined comments and load it through active record query.

Ashish Jambhulkar
- 1,374
- 2
- 14
- 26
-
thaks, but i ask how i can give a two ways to set comment in one field? (user can write or select from list) – Олег Кулаков Aug 10 '17 at 10:47
0
i find an answer in this https://stackoverflow.com/a/11898865/7437218 example:
<datalist id="cars">
<option>Volvo</option>
<option>Saab</option>
<option>Mercedes</option>
<option>Audi</option>
</datalist>
i can get option for datalist from model with predefined comments

Олег Кулаков
- 376
- 3
- 6