Questions tagged [simple-form]

Simple Form is a gem that offers a convenient way to generate view code for forms in Rails.

0
votes
1answer
18 views

Scope associations for a model used multiple times in a single form with simple_form and cocoon

I've found myself in the following semi-normal situation: class Contract has_many :contract_locations, dependent: :destroy has_many :locations, through: :contract_locations end class ...
0
votes
2answers
21 views

simple_form accept a hash for collection input

Current behavior With simple_form you need to pass an array: <%= f.input :my_field, collection: [[true,"Yes"],[false,"No"]] %> Expected behavior It would be nice to be able to pass a hash, ...
-4
votes
1answer
27 views

How to use simple_form to submit a form to database in Rails?

I have a blog app that uses Devise for auth. I want users to be able to have a profile, how would I do that using the simple_form gem? I tried: rails g controller AuthorProfiles rails g migration ...
0
votes
2answers
41 views

How do I create a drop down in a Rails form where the user can change the default value?

I'd like to have a drop down in my Rails form where users can select an area of a city, e.g. "Marchmont", "New Town", "Baberton" etc, when adding an order. I'd like that once they have made a ...
0
votes
1answer
8 views

Rails Simpleform selection is too long to fit

The Problem I am using rails version 5 and I am making a form where the user fills an input by selecting from different options. Here is what it looks like when it works: <% sectors = [["Energy",...
0
votes
0answers
42 views

Bootstrap Simple Form custom wrapper, input field is separated from prepend

Input group is not displaying the prepend correctly. The prepend appears, but then field drops to the next line. How do I fix this using only Bootstrap, I prefer not to modify the CSS, but open to it ...
0
votes
1answer
25 views

Ruby: Prefill New Model Form From Previous Page's Partial Form

Ruby on Rails, Simple Form. I have a contact/Message partial on several pages (product#index#show, static ‘services’ page) — when someone fills out the partial form and submits, I want the Message#...
0
votes
1answer
77 views

i18n file location and format for Named Spaced Form Object

I have a form object app/form_models/car_registration/basics.rb module CarRegistration class Basics < Base include ActiveModel::Model delegate :name, :name=, to: :vehicle end end ...
0
votes
0answers
16 views

Spring,simple form -improvement of the first project

I started writing one project and I have several questions.It is a calculator (alcoholic breathalyzer)Below is the code Model class: public class CalculatorFromData { private double coeffieicient; ...
1
vote
1answer
15 views

Losing params in url of a simple form when rendering new

I created a simple_form in my ruby in rails app. It's working fine except when there is an error in the form, and the form is reloaded, at this moment I lose the params in the url. (I Already read ...
1
vote
2answers
98 views

Simple Form- control width of label and input (with bootstrap)

I am using Simple_form and Bootstrap. I would like to use a horizontal wrapper, but I need to make the label wider and the input narrower. I would like to do this with bootstrap 4 vs custom css. The ...
-1
votes
1answer
40 views

Ruby on Rails 5: Can't Save Record, Unpermitted Parameter for Has Many Through Record

Ruby on Rails 5, Simple Form Product has many Specifications through ProductSpecs in Product#Edit, I want to add new Specifications. if Specifications.save successful, rerender Product. It ...
0
votes
3answers
42 views

Rails 5: Parameter Missing and Fail to Render Edit OR Unsaved Update / Unpermitted Parameters

Using Devise , Rails 5.0.6, Sqlite 3, Simple Form, Active Record 5.0. Bouncing between two parameter problems since looking up many similar problems/solutions throughout Les Vesti. In both ...
0
votes
0answers
16 views

Customize simple form radio buttons to match the theme markup

I’m using simple forms. The following line is what I have =f.input :live_mode, as: :radio_buttons, label: false which produces the following markup <div class="form-group radio_buttons optional ...
0
votes
2answers
19 views

Simple form 'selected' attribute not setting correctly

I have a simple form setup for a model. Although it's not working correctly. <%= f.input :folder, collection: current_user.folders, label_method: :name, value_method: :slug, selected: params[:...
0
votes
2answers
14 views

Rails Simple Form input with Font-Awesome

I want to use icons instead of text for labels in a horizontal simple_form. However, I am unable to separate the text from the icons = simple_form_for @user, html: { class: 'form-horizontal' }, ...
1
vote
1answer
58 views

Issues with Simple_form and accepts_nested_attributes_for

I'm quite new with RoR so sorry if I say something not correct. I have these models. class Course < ApplicationRecord has_many :frequencies, inverse_of: :course belongs_to :subject, optional: ...
0
votes
1answer
23 views

How to convert from `form_tag` to `simple_form_for` way for Sign In?

This snippet works fine: <%= form_tag(session_path) do |f| %> <p> <%= label_tag :email %> <%= email_field_tag :email, nil %> </p> <p> ...
0
votes
0answers
23 views

Rails Checkbox redesign sometimes sends wrong ids to controller

A user can select multiple products on my page (called vacancies) and then upgrade them. I use a checkbox: <input type="checkbox" class="hidden" name="vacancies[]" id="post_vacancy_ids_<%= ...
0
votes
1answer
23 views

Edit simple_form_for with namespace

I'm trying to create a form with Simple Form to edit users profile from admin interface. Here are my routes : namespace :admin do resources :users root 'admin#index' end Admin::...
1
vote
1answer
43 views

Ruby / Rails - How to accept nested_attributes with has_many through relation on a form?

I'm building a web app in rails and I'm quite new with nested attributes. I'm trying to create a facture and I need to register Clients, Candidats and Deals params at the same time. I found nested ...
1
vote
0answers
32 views

Add HTML element in radio_buttons with Rails and SimpleForm

For my project, i tried to insert an HTML element in the span block with the radio class generated by SimpleForm (cf example of my code below). But after many tests and research, i'm not arrived to ...
1
vote
1answer
26 views

Submit a form only one time - simple form

I am building a website where each user can review several papers and answers some questions on each paper. I want the user to be able to answer the questions of a specific paper only one time (i.e. ...
0
votes
1answer
17 views

Syntax Error Ruby Simple form dependent fields gem Haml

Im a rails newbie trying to implement the depending fields gem. I have been following this tutorial but keep getting syntax erros. I am Ruby Haml FYI https://www.rubydoc.info/gems/dependent-fields-...
0
votes
2answers
23 views

simple_form custom input with content_for javascript head?

I am using a datepicker and want to create a custom simple_form input currently I'm doing this on EACH form: <link rel="stylesheet" href="/datepicker/master/dist/datepicker.min.css"> <...
1
vote
1answer
71 views

How to prevent exit blocking script from disabling submit button after it's used

I have a script used to prevent navigation away from the page so changes are not lost accidentally. Unfortunately, this also "breaks" the page if the script is activated via submitting the form. So, I ...
0
votes
1answer
24 views

Rails simple form, input type date not showing all years (just 11)

I have a SimpleForm for a User, with birthday as an attribute: t.date "birthday" I generate a SimpleForm: <%= f.input :birthday %> Rails generates the 3 inputs for day, month and year: But ...
0
votes
1answer
17 views

Simple form remove associated record

I'm using simple_form and I would give user ability to quickly remove an associated record. (eg. "checking/uncheking") How is it possibile with simple_form? Is there another gem to help with this? ...
0
votes
0answers
17 views

Simple Form and Bootstrap errors hidden when outside input?

I have form errors not associated with an input field (confirmation_token), but the error is hidden. = simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { ...
1
vote
1answer
33 views

Simple_form does not send value after adding columns in the schema

I wanted to updated a simple_form with more values that the user can input. In order to do so I: 1) Create a new migrations adding in my database questions the new columns. The new columns apper is ...
2
votes
1answer
45 views

How to change label of simple form input

I Have a code in my project like <div class="form-inputs"> <%= f.input :twitter %> </div> It gives label as Twitter in my website. How it produce label with out giving label ...
1
vote
1answer
29 views

Calculated fields in SimpleForm with ruby on rails

I'm new in ruby on rails and my problem is with using of SimpleForm. I want to have disabled field "Summary" which is disabled for editing by user and calculated from other fields on this same form if ...
0
votes
1answer
42 views

Inputbox with button next to it shortens the width of the Inputbox width SAPUI5

I am adding a flexbox in a simpleform dynamically. The flexbox items contains inputbox and two buttons (in the same line). This is reducing the width of the inputbox. When I try to increase the ...
0
votes
0answers
21 views

How to show error and hint message separately in rails slim file using simple-form?

I am using simple-form with slim file in rails. I need to show hint and error message in two separate lines = f.input :product_name, label: 'please provide name', required: true, hint: '1) Be ...
0
votes
0answers
24 views

Upload redisplay not working with Carrierwave

_form.html.erb: <%= simple_form_for([category, post], html: { multipart: true } ) do |f| %> <%= f.input :title %> <%= f.input :description, as: :text %> <%= f.input :...
0
votes
0answers
12 views

Simple Form Dropdowns and Booleans Not Appearing in Rails App

I have long used the simple_form in this form, but somehow the dropdowns and booleans have stopped appearing. The weird thing is if I look in the code inspector, they're still there and should ...
0
votes
2answers
42 views

Best way to cache unsaved form data on refresh in rails 5

I have a huge multiply nested forms which take a while to be filled. I am looking for a way to cache their form data if a user mistakenly refreshes the page or goes back. It becomes a major pain when ...
0
votes
1answer
27 views

In rails view using simple-form Is there any way to restrict selecting future date in date picker?

I am using common date-picker in rails view using simple form gem. I need to restrict user by selecting future date in simple form itself = f.input :start_date, label: 'Select Date', wrapper_html: {...
0
votes
0answers
16 views

Is there any way to show only date instead of datetime stamp using simple-form gem rails slim file?

In Rails slim file i need to show only date in edit file instead of showing datetime stamp . I am using simple-form gem = f.input :start_date, label: 'Select Date' wrapper_html: {class: 'col s12 '}, ...
1
vote
1answer
23 views

Simple form and bootstrap incompatible css

I am trying to copy this simple design into edit mode. Here is the code displaying the image above : <div class="user-description-container col-md-6 col-md-offset-3"> <div class="col-md-...
1
vote
0answers
32 views

Simple form with collection select returning a hash

I am trying to get a dropdown list of projects organized according to the owner name. For doing this I am using SimpleForm and the grouped_select method. The issue is that for now it is a hash that is ...
0
votes
1answer
41 views

Field gets radio button's item id instead of its value

I have snippet: <%= f.input :purpose, as: :radio_buttons, collection: category.subcategories, wrapper: :vertical_collection_inline %> which lines values of category.subcategories ...
0
votes
1answer
44 views

how to create div inside fieldset in rails simple form

I got simple form with associated checkboxes. And i need to style that checkboxes with twitter bootstrap class "col-md-4" which render that checkboxes in 3 columns. but it needs 'row' class on a ...
0
votes
0answers
26 views

setting a simple_form assocation item input or label class

I have the following simple_form builder invocation: f.association(:facility, { as: :radio_buttons, label: false }) Which generates: <div class="attribute radio_buttons required swipe_facility"&...
0
votes
2answers
30 views

How to delete attribute name from invalid feedback below simple form checkbox?

On the screenshot, you'll see that invalid feedback is specifying the attribute name from the input, here "Adulthood". I don't want it and i can't delete it. It's not in the acceptance message from ...
1
vote
1answer
46 views

Collection_Select Does Not Respond to Input_HTML: {Multiple: True}

I am attempting to create a feature where users can add an existing record, recipe, to a collection of records, menu. I am using collection_select with a simple_form to allow users to select multiple ...
0
votes
1answer
21 views

Ruby on Rails - Selected values are not working as expected in multiple: true (simple_form)

In my form, I have an f.select with multiple: true, but select doesn't work if it's not hardcoded in. This is my form in new view: = f.select :os, get_uniq_objects(:os), {}, {multiple: true } My ...
0
votes
1answer
45 views

ActionView::Template::Error (Missing block): while using simple_form_for

I created a page showing posts and if I open any particular post say "localhost:3000/newsfeeds/14". I want to render comments and comment form in that too. My routes are: newsfeed_comments GET /...
0
votes
2answers
51 views

Simple_form_for action hitting wrong URL on edit in rails

I have created a simple_form_For common for both new and update, currently, it's working fine for new but for edit/update, it calling the wrong URL. class NewsfeedsController < ...
0
votes
1answer
39 views

Adding new field in RoR simple-form gives ActionView::Template::Error

We are looking to add a new hidden field into our form but every time I add in a new field (even copy and pasting a field that works and just adding a number to the end) we get an error, ActionView::...

http://mssss.yulina-kosm.ru