Alright, so I have a Thread module and a Post module, and to create Posts the new.html from posts is rendered in a section of the thread template, however, when the post’s content is empty I have an error to show up saying a post cannot be empty.
<%= form_for @changeset, post_path(@conn, :create), fn f -> %> <%= if @changeset.action do %> <div class="alert alert-danger"> <p>Oops, something went wrong! Please check the errors below.</p> </div> <% end %> <div class="form-group"> <%= text_input f, :content, placeholder: "Type post's content here. You can use Markdown Syntax to personalize your post.", class: "form-control" %> <%= error_tag f, :content %> </div> <%= submit "Submit", class: "btn btn-primary" %> <%end%>
However, when the error is triggered, it redirects me to the Post module for a new entry and the thread the html is rendered on disappears(And as proof, I’m on the post url instead of the thread url). Is there a way to make it so just the rendered section reloads for the error instead of it redirecting me to the post module?