After submitting simple_form i get a blank page in show view

skosman

I have created a simple form, the user click on three items and press submit and an email is being send, all of this works. However, when i test it and check the show page, it doesn't show any entered details which were selected by the user, just a blank page.i don't receive any errors.

controller

class PositionsController < ApplicationController

  def new
    @position = Position.new
  end

  def show
    @position = Position.find(params[:id])
  end

  def create
    @position = Position.new(position_params)
    if @position.save
      PositionMailer.general_message(@position).deliver
    else
      render :new
    end
  end

  private def position_params
    params.permit(:date, :time, :activity)
  end
end

view

<div class="form">
  <%= simple_form_for @position  do |f| %>
    <div class= "trip">
        <div class="trip-text">
          Trip number
        </div>
        <div class="trip-field">
          <%= f.input :tripnumber, label: false, placeholder: 'enter here' %>
        </div>
    </div>
    <div class= "activity">
      <div class="activity-text">
        Activity
      </div>
      <div class="activity-field">
        <%= f.input :activity, label: false, collection: [['Sailing to loadport, expected arrival', 'Sailing to loadport, expected arrival'], ['Sailing to discharge port, expected arrival', 'Sailing to discharge port, expected arrival'],
          ['Loading untill', 'Loading untill'], ['Discharging untill', 'Discharging untill'], ['Waiting for loading, expect to start', 'Waiting for loading, expect to start'], ['Waiting for discharge, expect to start', 'Waiting for discharge, expect to start']] %>
       </div>
    </div>
    <div class="date">
      <div class="date-text">
        Date
      </div>
      <div class="date-field">
        <%= f.date_field :date, class: 'form-control' %>
      </div>
    </div>
    <div class="time">
      <div class="time-text">
        Time
      </div>
      <div class="time-field">
        <%= f.time_field :time, value: "%H:%M", min: 'hh:mm:ss', max: 'hh:mm:ss' %>
      </div>
    </div>
  <%= f.submit "Send update", class: "submit"%>
</div>

Since i have no error and all works fine except i dont have the input of the users i dont know where to look, i looked in the forum and on google but no succes

Rajdeep Singh

In create action, add redirect_to @position

if @position.save
  PositionMailer.general_message(@position).deliver
  redirect_to @position
else
  render :new
end

Hope that helps!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I have a blank page after submitting a php mysqli update form,

Blank Page After Submitting Form in Laravel

Getting blank page on submitting form

How can i get data or pass a data from one page to another after submitting a form in reactjs

How can I show the output vertically after submitting the html form?

How to get the sucess message in the same page after submitting the contact form?

How to get the success message in the same page after submitting the form?

after submitting a form to email i get 2 email instead 1

How can I get the form values to appear in the table after submitting?

Rails simple_form - Nested Form NoMethodError in "show" page

Can't get rid of blank php page after submission form

Form not submitting Select options and I get a blank screen and no error in error log PHP/SQL

Show bootstrap popover after submitting form that is in modal

Form submitting field as Blank. Using Javascript to hide and show fields

How to show errors while submitting blank form - React redux

How to redirect to List View Page in PHP CodeIgniter using parameters after submitting a form?

Redirect to other view after submitting form

localStorage page does not display after submitting form

redirect to another page after submitting a form

form in php not redirecting to page after submitting

After submitting 'Contact' message, how do I get it to stay on page and generate a text confirmation?

How do I show a blank page in Safari?

Redirecting user to another page after submitting the form using get_absolute_url() method

How to get a value from a simple_form in the same view in Rails

After submitting my React form, is there an easier way of passing an object to the page I want to redirect to?

How can I redirect to a new page after submitting a form using Jinja template?

I use java Servlets and cannot redirect to another page after submitting form and sending data in JSON format

User gets registered every time I refresh the page after submitting form

After login get blank page only in chrome