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
17 views

Make the simple form action a url without having a model

Is it possible to have a simple form that purely directs to a controller action via a url and not have a model name? See my attempted code below, but it currently makes the url i want the form to ...
-4
votes
1answer
26 views

undefined method `model_name' for nil:NilClass problem with simple_form form

simple_form creates a problem: I'll explain what I did: i've 2 scaffold: questions/_form.html.erb - `<%= simple_form_for(@question ) do |f| %> <%= f.error_notification %> <div ...
0
votes
0answers
9 views

Selectize send multiselect as just a string not an array

Im using the rails selectize gem and working on a multiselect, but I dont want an array sent and I would like to send the options as a single string. Im using the select as a way to limit how they ...
-1
votes
1answer
24 views

simple_from_for with decimal precision doesn't save decimals

I am using simple_form_for for my form template which is not storing decimal numbers into my database table. When I submit the form, it throws away the precision. Here is what I have: my schema.rb ...
0
votes
0answers
19 views

Update only one association with simple_fields_for

I'm wondering what is the best solution to individually update an associated record with simple_fields_for. I have texts associated to an order. So this what I have in my view: = f.simple_fields_for(...
1
vote
1answer
30 views

Rails Simple Form with Bootstrap remove validations

I have a form with nested has_many assocations and got everything working fine, except when its load all the fields previously there for editing, have a checkmark next to them. Ive figured out its to ...
0
votes
1answer
32 views

Form data not saving to database on form loaded from different controller / view

Sorry for the vague title. I want to enable comments on a post / comments type system (in my case snags and snag comments). I have a snags table, a snag_comments table and a has many / belongs to ...
0
votes
0answers
19 views

Is there a way to change the place holder for simple form for as: :select option?

From the simple_form_for select option, I get a placeholder that says "select some options". I am trying to customize this and I can't seem to find a way to do so. placeholder option does not work nor ...
2
votes
1answer
48 views

Using for_each to iterate over form inputs

I have two forms, one with uk_inputs and one with international_inputs. When one or more of the uk_inputs are filled out I want it so the international inputs in the other form are disabled. This ...
-1
votes
0answers
36 views

Disable form inputs when typing in another form input

I currently have two forms on one page. I want to write some javascript so that, when a user starts to type in one/any of the inputs in one form, the inputs in the other form disable. This is to avoid ...
-1
votes
1answer
23 views

How to have a default value in the database but not in the form input

I'm creating a registration form where a user inputs there address details. For the country field, i would like it to be defaulted to "united kingdom', in the database unless specified other wise, but ...
0
votes
1answer
25 views

Rails simple_form - is it possible to display radio_buttons with just button labels?

This code: <%= f.input :exploratory, as: :radio_buttons, collection: [['Exploratory', true], ['Preparatory', false]], label: false %> Produces this result: Which is almost exactly what I ...
0
votes
1answer
19 views

How to add Javascript validations to Rails simple_form?

I want to validate some inputs on my Rails simple_form. HTML is good but not working with many InAppBrowsers. <%= simple_form_for(:member, :url => registration_path(:member), html: { multipart: ...
0
votes
1answer
52 views

Nested association has_many;through doesn't update collection_check_boxes

Using check boxes to update the nested form I can't update the tables. I received following message: Unpermitted parameter: :category ActionController::Parameters {"name"=>"Flux Capacitor", "...
0
votes
1answer
36 views

How to specify another class to hidden input wrapper?

I update the project from bootstrap v.3 to bootstrap v.4. I update simple_form and now, when I specify simple_form input tag as 'hidden': = f.input :id, as: :hidden, input_html: { value: nil } It ...
0
votes
1answer
26 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
31 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
37 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
48 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
9 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
57 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
29 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
95 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
17 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
19 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
146 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
44 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
49 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
20 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
20 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
3answers
58 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
70 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
26 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
35 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
44 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
37 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
28 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
22 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
27 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
75 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
31 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
21 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
56 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
43 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
27 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
26 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 :...

http://mssss.yulina-kosm.ru