Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable field order #76

Open
jonathonadler opened this issue May 16, 2021 · 2 comments
Open

Configurable field order #76

jonathonadler opened this issue May 16, 2021 · 2 comments

Comments

@jonathonadler
Copy link

Currently, it is only possible to output fields in order [label, input, error]. My project CSS required the label to be rendered after the input field i.e. [input, label, error].

I had to override the whole formulator module to overcome this:

  defp build_input_and_associated_tags(form, field, label_options, fun) do
    error = HtmlError.html_error(form, field)
    [
      fun.(error),
      build_label(form, field, label_options), # JA, swap label position
      error.html
    ]
    |> Enum.reject(&(is_nil(&1)))
  end

It would be great if order was configurable.

@dbernheisel
Copy link
Collaborator

Since you did it this way, it sounds like across your entire project you always put the label after the field. Do you think there is a case for this to be configurable at the input level? eg, only for text fields reorder the elements? or eg only for this field reorder the element?

@jonathonadler
Copy link
Author

jonathonadler commented May 23, 2021

That’s correct. For my project, I would like to change the field order globally. I imagine there will be exceptions from to time though, so a per field override would also be very helpful.

Thanks for taking the time to look into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants