Settings phoenix_simple_form

Good…
I am currently trying to use phoenix_simple_form.
But I’m having some difficulties integrating with phoenix.simple_form.

templates/name/form.html.eex

<%= label f, :city_id, class: "control-label" %> <%= text_input f, :city_id, class: "form-control" %> <%= error_tag f, :city_id %>

Note: city_id = Database MySQL

Has anyone used this in elixir?
As?

1 Like

Usually helps to say what error you are getting. ^.^

Cannot tell what is wrong with the code given.
Also, this forum uses standard markdown for formatting, so you can use code fences ``` on blank lines to format the code, like:
```
<%= label f, :city_id, class: “control-label” %>
<%= text_input f, :city_id, class: “form-control” %>
<%= error_tag f, :city_id %>
```
Becomes:

<%= label f, :city_id, class: "control-label" %> 
<%= text_input f, :city_id, class: "form-control" %> 
<%= error_tag f, :city_id %> 

:slight_smile:

2 Likes

It does not make mistake.
The code is right.
I want to add only a list type button.
About formatting, thank you.

1 Like

Well, the question still a little bit confusing.

What do you intent to do? Do you have any example?

2 Likes

Checking an image, will make it easier to understand …
I needed a button like that on my page.

1 Like

Ah, so just select/4? It is already in Phoenix.HTML. :slight_smile:

3 Likes

Right! So the function you want is select/4

You can use it like this:

<%= label f, :city_id, class: "control-label" %>
<%= select(form, :city_id, ["New York": "ny", "San Francisco": "sf"]) %>
<%= error_tag f, :city_id %>

Se precisar de algo a mais é só falar! Mas em inglês pra galera não se perder. :wink:

3 Likes

Also, @gilbertosj, there is the brazillian elixir group on telegram if you are interested: https://telegram.me/elixirbr

1 Like

that’s right…
Thank you so much

1 Like