rails - what exactly does hidden_field and hidden_field_tag do?

前端 未结 2 889
旧巷少年郎
旧巷少年郎 2020-12-14 19:12

I read through the techy definition of hidden_fields, but am not sure what it really does. My understanding is that it allows you to pass in an attribute for c

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 19:35

    It would generate a hidden type of input field...

    This is a way to store information that you want submitted with the form without having to have a visible field.

    From the documentation:

    hidden_field_tag 'tags_list' generates...

    hidden_field_tag is meant to be used without a model whereas hidden_field is meant to be used in conjunction with a form_for call and a model.

    hidden_field(:signup, :pass_confirm) generates...

提交回复
热议问题