ForageWeb.ForageView.forage_select_filter

You're seeing just the function forage_select_filter, go back to ForageWeb.ForageView module for more information.
Link to this function

forage_select_filter(form, field, path, opts \\ [])

Widget to select an external resource using the Javascript Select2 widget.

Parameters:

  • form (t:Phoenix.Html.Form.t/0)- the form
  • field (atom)
  • path (binary) - the URL from which to request the data

Options:

  • :foreign_key (optionsl) - The name of the foreign key (as a string or an atom). If this is not supplied it will default to field_id

This filter (like all forage filters) will add the appropriate parameters to your HTTP query so that the Forage functions in the backend can create a properly paginated and filtered query.

Example

Filter a list of employees

<%= forage_horizontal_form_group(f, :department,
      dgettext("mandarin.backoffice", "Department"), [],
      fn form, field, opts ->
        forage_select_filter(form, field, Routes.backoffice_department_path(@conn, :select), opts)
      end) %>