filestack/filestack-rails

Get the dom element?

Closed this issue · 1 comments

Hi,

We are currently migrate from v2 to v3. This is one of our form input:

= f.filepicker_field :upload_url,
  services: 'COMPUTER',
  button_text: "My text",
  button_class: 'my-classes'
  onchange: 'fpUpload.display(event, this)'

In our fpUpload.display function, we can get the dom element with this variable. We are trying to do the same with v3 but the get_filestack_field_button method append only data var.

We found this work around but it's not very beautiful...

= f.filestack_field :upload_url, "My text",
  pickerOptions: { fromSources: 'local_file_system' }, 
  callback: 'fpUpload.display(filestack_input_field, data);console.log', 
  class: 'my-classes'

Do you have any other way to recover the DOM element?

Our solution:

= f.filestack_field :upload_url, "My text",
  pickerOptions: { fromSources: 'local_file_system' }, 
callback: '(function (data){fpUpload.display(filestack_input_field, data);})',
  class: 'my-classes'