Service
<%= select_tag 'employee', options_for_select(%w{None ITS RDS
Corporate},"None") %>
The problem is when i submit the form data it is not storing
anything in the database… But when i am not using combo box its
working fine. The controller code is…
You’re using select instead of select_tag, so there parameter is being
submitted as params[:employee], clobbering the rest of the data (a
hash in params[:employee]).
Either use select or your select_tag should be select_tag
‘employee[foo]’, … instead of what it currently is.
Hi Fred,
Thanks for your suggestion… I have made the necessary
changes that you said…now the error is gone but still the data is
not getting added in the database…
Hi Fred,
Thanks for your suggestion… I have made the necessary
changes that you said…now the error is gone but still the data is
not getting added in the database…
The logical question to ask is why is it not getting saved? If a
validation is failing, which one? In the logs what is the data that
rails is receiving ? etc…
Hi Fred,
I checked in the log file, you are right some validation
is failing… Actually when the create method is getting fired, rails
is generating an insert statement…in that insert statement the
field for which I have put the combo box that name isnt there.
When I started developing this application I used
scaffold…the view part generated by rails did not have any combo
box. All were text fields except the date. I replaced one text field
with the combo box. Do you think that could be the problem??? I am
new to this ROR and I am not getting any clue…
scaffold…the view part generated by rails did not have any combo
box. All were text fields except the date. I replaced one text field
with the combo box. Do you think that could be the problem??? I am
new to this ROR and I am not getting any clue…
In the log file, what is being submitted by the browser?
Hi,
I forgot to give one information…The table in the database is having
5 fields…
Fname, Lname, Date of joining, email and service. It is the last
field for which i am using the combo box. Is it possible to force
rails to generate a combo box according to the requirement???
Your form isn’t submitting the service field, so it’s nothing to do
with the database stuff.
You probably want to look at the source for your entire field to
figure out why this is happening.
Fred.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.