Flash Messages and validation errors do not appear on webpage

I have a challenge with flash messages and validation error <%= error_tag f, :patient_name %> not showing when I submit the form. Below are snippets if the code


<main role="main">
  <p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
  <p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
  <%= render @view_module, @view_template, assigns %>


def create(conn, %{"room_id" => room_id, "appointment" => appointment_params}) do
    params = Map.merge(appointment_params, %{"room_id" => room_id})

    case Appointments.create_appointment(params) do
      {:ok, _appointment} ->
        |> put_flash(:info, "Appointment Created")
        |> redirect(to: MeetNowWeb.Router.Helpers.appointment_path(conn, :new, "room_id"))

      {:error, %Ecto.Changeset{} = changeset} ->
        render(conn, "new.html", changeset: changeset)


and my new.html.eex

<section class="floaty-mc-floatface">
  <div class="logo"></div>
    <%= form_for @changeset, MeetNowWeb.Router.Helpers.appointment_path(@conn, :create, @room_id), fn f -> %>
      <%= if @changeset.action do %>
        <div class="alert alert-danger">
          <p>Oops, something went wrong! Please check the errors below.</p>
      <% end %>
      <label class= "white-label">
        Display Name: <%= text_input f, :patient_name, class: "black-text-input"%>
        <%= error_tag f, :patient_name %>
      <%= submit "Enter" %>
    <% end %>

Hey there! Only a few places I can think of to look:

  • Is the route piped through a pipeline that has plug :fetch_flash?
  • No errant CSS that could be hiding those classes?
  • Do you have an error tag for the field that is erroring (IO.inspect changeset)

Kind of a long shot, but maybe the error_tag function was modified and isn’t returning as you’d expect?