开发者

rails: pass value of a text field to a helper function

开发者 https://www.devze.com 2023-01-19 06:07 出处:网络
I\'m sure this is a basic question... I have a nested form where the nested object contains a text field. There is a link_to_function in the form that calls some javascript. I want to pass the ja开发者

I'm sure this is a basic question... I have a nested form where the nested object contains a text field. There is a link_to_function in the form that calls some javascript. I want to pass the ja开发者_运维问答vascript function the value of a hidden field in the form (image_type_id).

Can I reference this with some ruby or does this need javascript?


Pass this (or this.parent, depending on where your link is on the form) and use jQuery on the Javascript side to get the hidden value.

0

精彩评论

暂无评论...
验证码 换一张
取 消