Module: JSignature::ViewHelpers

Defined in:
lib/jSignature/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#sign_form_field(name, height = 200, width = 500) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/jSignature/view_helpers.rb', line 3

def sign_form_field(name, height = 200, width = 500)
  render :inline => "<%= text_field_tag(:#{name},\"\", :hidden => true) %>
    <div id='#{name}_sig'></div><script> $(document).ready(function() {
var x = $('##{name}_sig');
x.jSignature({'height': #{height}, 'width': #{width}});
x.change(function(){
  $('##{name}').val(x.jSignature('getData'));
});

  });</script>"
end