0

I have a remote bootstrap validator added like this (from http://bootstrapvalidator.com/validators/remote/):

form.bootstrapValidator
    trigger: 'blur',
    fields:
      'tenant[domain]':
        validators:
          remote:
            type: 'GET',
            url: (validator) ->
              return Routes.tenant_domains_path($('#tenant_domain').val())

The problem is that neither type nor url options are working.

Output in js console is:

POST http://localhost:3000/shop/function%20(validator)%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20Routes.tenant_domains_path($(%27#tenant_domain%27).val());%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20}?tenant%5Bdomain%5D=testdomain 404 not found

and it should be (i want it to be ;P ):

GET http://localhost:3000/shop/testdomain/domains

In addition the form is not submitting (but there are no errors).

If it is important, here is the form:

<%= form_for @tenant, {role: 'form', html: {multipart: true}} do |f| %>
  <%= f.text_field :domain, required: true %>
  <%= f.submit t('tenant.new_tenant'), class: 'btn btn-primary' %>
<% end %>

What am I doing wrong here?

EDIT: Oh, and

$.getJSON Routes.tenant_domains_path($('#tenant_domain').val())

is sending data to proper url:

GET http://localhost:3000/shop/testdomain/domains
Mafi
  • 196
  • 2
  • 7

0 Answers0