aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/form_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge pull request #22764 from ↵Rafael Mendonça França2016-03-051-2/+0
| | | | | | | | | | stevenspiel/titleize_model_name_for_default_submit_button_value" This reverts commit 4158974c60d817c9bc1e2aecb342161295f2ac0d, reversing changes made to 3d590add45b7ff1de972d99b076cb504d5208935. Reason: This break i18n in some languages. See https://github.com/rails/rails/issues/791#issuecomment-192724640
* html_safe is not supposed to be public API for AV. This change removes usage ↵Vipul A M2016-01-201-2/+2
| | | | | | of html_safe in favour of raw() in AV helpers. Also changed usage of html_safe to make use of raw() instead so that the intended behaviour is verified with raw()
* downcase default submit button value's model nameSteven Spiel2016-01-011-0/+2
|
* [ci skip] Fix which method `FormHelper#date_field` try to callyui-knk2015-09-271-1/+1
| | | | | | | | | | | | When this method was implemented (https://github.com/rails/rails/pull/5016/files), `to_date` is called. But this behavior was chagned refactoring (https://github.com/rails/rails/pull/6452/files). In the first commit, there were not test which asserts `to_date` is called. I think trying `to_date` is more useful than trying `strftime`, because we can write `"2015-01-01".to_date`. But first fix comments to match actual behavior.
* Merge pull request #21431 from ojab/masterRafael Mendonça França2015-09-261-1/+8
|\ | | | | Handle nested fields_for by adding indexes to record_name
| * Handle nested fields_for by adding indexes to record_nameojab2015-08-301-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of the form with nested fields_for, i. e. <%= form_for :foos, url: root_path do |f| %> <% @foos.each do |foo| %> <%= f.fields_for 'foo[]', foo do |f2| %> <%= f2.text_field :id %> <% foo.bars.each do |bar| %> <%= f2.fields_for 'bar[]', bar do |b| %> <%= b.text_field :id %> <% end %> <% end %> <% end %> <% end %> <%= f.submit %> <% end %> rails doesn't add index for 'foo' in the inner fields_for block, so field names in the outer fields_for looks like "foos[foo][#{foo_index}][id]" and in the inner "foos[foo[]][bar][#{bar_index}][id]". Submitting of such form leads to an error like: >ActionController::BadRequest (Invalid request parameters: expected Array >(got Rack::QueryParser::Params) for param `foo'): This commit adds indexes for the foos in the inner blocks, so field names become "foos[foo][#{foo_index}][bar][#{bar_index}][id]" and submitting of such form works fine as expected. Fixes #15332
* | Correcting output of `file_field` with `multiple` attribute option [ci skip]amitkumarsuroliya2015-09-221-2/+2
| |
* | No need the `a`shingo.nakanishi2015-09-171-2/+2
| |
* | Fixed helpers submit button Examples [ci skip]shingo.nakanishi2015-09-171-1/+1
|/
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-05-081-0/+1
|\
| * [ci skip] Add an example to ActionView::Helpers::FormBuilder#labelyui-knk2015-05-081-0/+1
| |
* | [ci skip] Fix example codes of form_for methodyui-knk2015-05-021-26/+36
| |
* | Override default form builder for a controllerKevin McPhillips2015-04-131-1/+3
|/
* Accept lambda as child_index option in #fields_for methodKarol Galanciak2015-04-051-1/+5
|
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-03-261-0/+1
|\ | | | | | | | | Conflicts: guides/source/4_0_release_notes.md
| * [ci skip] Add a line between code example and docsyui-knk2015-03-211-0/+1
| |
* | Rework form helper example to use Person.newCarlos Antonio da Silva2015-03-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | The previous change 92a3c8dcdf174dab5e8759031b6bbe6cd891fe3c improved this example, but calling .create + #valid? ends up running validations twice, and we don't want to showcase that. Lets use the normal use case of building a new object and calling #save on it, which is what a basic scaffold with Active Record does. [ci skip]
* | [ci skip] Check a result of `valid?` instead of `create`yui-knk2015-03-211-1/+2
|/
* Fix typos in ActionView::Helpers::FormBuilder comment [ci skip]Yu Haidong2015-02-261-1/+2
|
* Use a name that better reflect the return valueRafael Mendonça França2015-02-201-2/+2
|
* Merge pull request #17138 from jpcody/rename_default_form_builderRafael Mendonça França2015-02-201-2/+2
|\ | | | | | | Rename default_form_builder to avoid collision
| * Rename default_form_builder to avoid collisionJoshua Cody2014-10-011-2/+2
| |
* | Remove RecordTagHelper, add extraction noticesTodd Bealmear2015-02-161-0/+2
| | | | | | | | | | | | | | Per DHH in #18337, ActionView::Helpers::RecordTagHelper has been extracted to an external gem (source currently lives at todd/record_tag_helper). Removal notices have also been added for anyone upgrading that use the extracted methods.
* | Follow up to #17973 [ci skip]Robin Dupret2015-01-021-9/+10
| |
* | Add a hidden_field on the file_fieldMauro George2015-01-021-0/+17
| | | | | | | | | | This will avoid a error be raised when the only input on the form is the `file_field`.
* | Bugfix config.action_view.default_form_builder optionBogdan Gusiev2014-12-011-1/+3
| |
* | Merge pull request #17685 from claudiob/document-form-for-extra-optionsRafael Mendonça França2014-11-201-0/+15
|\ \ | | | | | | | | | | | | | | | | | | Document *all* the options accepted by form_for Conflicts: actionview/lib/action_view/helpers/form_helper.rb
| * | Document *all* the options accepted by form_forclaudiob2014-11-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The [current documentation of form_for](http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for) is incomplete: > The rightmost argument to form_for is an optional hash of options - > :url - The URL the form is to be submitted to. This may be represented in the same way as values passed to url_for or link_to. So for example you may use a named route directly. When the model is represented by a string or symbol, as in the example above, if the :url option is not specified, by default the form will be sent back to the current url (We will describe below an alternative resource-oriented usage of form_for in which the URL does not need to be specified explicitly). > :namespace - A namespace for your form to ensure uniqueness of id attributes on form elements. The namespace attribute will be prefixed with underscore on the generated HTML id. > :html - Optional HTML attributes for the form tag. This commit completes the documentation by specifying that: * `:authenticity_token` is also a valid option (as [documented here](https://github.com/rails/rails/blob/b0f44c9ff0be84ebc42760029adeeb9dd954655f/actionview/lib/action_view/helpers/form_helper.rb#L396)) * `:method` is also a valid option (as [tested here](https://github.com/rails/rails/blob/b0f44c9ff0be84ebc42760029adeeb9dd954655f/actionview/test/template/form_helper_test.rb#L1819)) * `:remote` is also a valid option (as [tested here](https://github.com/rails/rails/blob/b0f44c9ff0be84ebc42760029adeeb9dd954655f/actionview/test/template/form_helper_test.rb#L1850)) [ci skip]
* | | Add `:enforce_utf8` option to form_forclaudiob2014-11-201-0/+3
|/ / | | | | | | | | | | | | | | | | Since 06388b0 `form_tag` accepts the option `enforce_utf8` which, when set to false, prevents the hidden "UTF8 enforcer" field from appearing in the output. This commit implements the same behavior for `form_for`. Stems from https://github.com/rails/rails/pull/17685#issuecomment-63871395
* / Fix typo at form_helper docs [ci skip]Pablo Herrero2014-10-291-2/+2
|/
* Remove wrapping <div> in form helpers from docclaudiob2014-09-221-13/+5
| | | | | | | | | | [ci skip] 89ff1f8 and 1de258e6 removed from the HTML generated by the form helpers the <div> that was wrapping the field elements inside the <form>. This commit updates the documentation of the methods to reflect the two commits above.
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2014-08-191-1/+1
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb actionview/lib/action_view/vendor/html-scanner/html/sanitizer.rb activerecord/lib/active_record/type/value.rb
| * Uppercase HTML in docs.Hendy Tanata2014-08-081-1/+1
| | | | | | | | [skip ci]
* | Merge pull request #15889 from carnesmedia/model-nameRafael Mendonça França2014-08-171-2/+2
|\ \ | |/ |/| | | Use #model_name on instances instead of classes
| * Use #model_name on instances instead of classesAmiel Martin2014-06-241-2/+2
| | | | | | | | | | | | This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class. Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
* | Add String support for min/max attributes on DatetimeFieldTodd Bealmear2014-06-301-0/+48
| |
* | Tiny documentation fixes [ci skip]Robin Dupret2014-06-291-1/+1
|/
* call `capture` fewer times from `form_for`Aaron Patterson2014-06-021-1/+2
|
* :cry::gun: use an empty hash for magical speed.Aaron Patterson2014-05-121-1/+5
| | | | | | For some reason, if the hash is empty, we choose "optimized" routes. I am not sure how or why optimized routes differ from regular routes. But, if we make sure the hash is empty, we get a nice speed improvement.
* Add test for using ActionView::Helpers::FormHelper.label with block and htmlZachary Scott2014-04-221-0/+1
|
* Fix 'fields_for' doc typo.Cakey | Buddy Magsipoc2014-03-101-2/+2
|
* Switched to use `display:none` in extra_tags_for_form method.Gaelian Ditchburn2014-01-051-4/+4
| | | | | | | | | | | | | The use of `display:inline` with the content_tag call in the extra_tags_for_form method potentially causes display issues with some browsers, namely Internet Explorer. IE's behaviour of not collapsing the line height on divs with ostensibly no content means that the automatically added div containing the hidden authenticity_token, utf8 and _method form input tags may interfere with other visible form elements in certain circumstances. The use of `display:none` rather than `display:inline` fixes this problem. Fixes #6403
* Change all "can not"s to the correct "cannot".T.J. Schuck2014-01-031-2/+2
|
* Merge pull request #13138 from gsamokovarov/remove-cattr-requiresGuillermo Iguaran2013-12-021-1/+1
|\ | | | | Remove deprecated cattr_* requires
| * Remove deprecated cattr_* requiresGenadi Samokovarov2013-12-031-1/+1
| |
* | Make ActionView::Tags loading tread safeRafael Mendonça França2013-12-021-1/+0
|/
* Fix typo in form_helper.rbAdam Jahnke2013-10-161-1/+1
|
* form_for - fix :namespace and :as options clashAdam Niedzielski2013-09-091-1/+2
| | | | | | | | :as option should not overwrite :namespace option when generating html id attribute of the form element. id should be prefixed by specified namespace even if :as option is present Add test case showing the issue and code fixing it
* Remove `FormBuilder` deprecation warning about block argument and associated ↵Vipul A M2013-07-021-5/+1
| | | | tests
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+1880