What if I just want to set the datetime in new and display a datetime
column with it’s date in edit but not let the user change it, how do I
do that?
Pål Bergström wrote:
What if I just want to set the datetime in new and display a datetime
column with it’s date in edit but not let the user change it, how do I
do that?
<%= you_object.your_date_field %>
Or try using the option {:disabled => true} in your form helper…
bmgz wrote:
P�l Bergstr�m wrote:
What if I just want to set the datetime in new and display a datetime
column with it’s date in edit but not let the user change it, how do I
do that?<%= you_object.your_date_field %>
Or try using the option {:disabled => true} in your form helper…
How do I do that? This is the form:
<%= start_form_tag :action => ‘create’ %>
<%= render :partial => ‘form’ %>
<%= link_to ‘Back’, :action => ‘list’ %>
How do I do that? This is the form:
…
This is the line renders the form’s contents:
<%= render :partial => ‘form’ %>
It is rendering another file named "form.rhtml" which is probably in
the same folder you found the one you quoted (‘new.rhtml’?). The '’
indicates the file is to be rendered as a partial (as in partial
page). Look in that file and you will see where the date field is
being rendered. Play with that a bit. That’s where you might try
Bmgz’s suggestion:
Or try using the option {:disabled => true} in your form helper…
Caveat:
The _form.rhtml file is used by both the ‘new.rhtml’ and ‘edit.rhtml’
pages. So if you change it it will be that way on both. To work
around this you could create a different partial and render that
instead…
Good luck with Rails!
–
(**********************************************************
- Peter H. Boling
- Web Application Designer - PanEther, LLC
- email: [email protected]
- blog: http://galtzo.blogspot.com/
- languages: English, Spanish, Portuguese
***********************************************************)