Questions tagged [formtastic]
Formtastic is a Rails form builder plugin with semantically rich and accessible markup.
697
questions
0
votes
3
answers
61
views
ActiveAdmin / Formtastic - How to have an input that is not associated to the model?
I'm using activeadmin and in a form associated with a model I would need to add a checkbox that is not tied to any of the model attributes. It should be just a checkbox that won't allow to submit the ...
3
votes
0
answers
78
views
Managing the behavior of the "Cancel" link in Rails' ActiveAdmin forms
A typical form produced by the ActiveAdmin DSL might look like so:
ActiveAdmin.register Post do
...
form do |f|
f.inputs do
f.input :title
f.input :content
end
f.actions
...
0
votes
0
answers
11
views
Rails / Formtastic - number (ID) for association instead of select
I'm building a form for a class with a belongs_to association, and the parent class is identified by ID and has a ton of records - a select doesn't make sense at all. I would like to just ask for the ...
1
vote
1
answer
54
views
Starting with a minimum number of children in an ActiveAdmin has_many relationship
Let's say I have a collection of books, each book can have multiple authors and I am using a has_many relationship between my Book and BookAuthor models.
In ActiveAdmin, I'd build the form like this:
...
0
votes
1
answer
117
views
Unknown Attribute on Rails Model for nested attributes of a hash key
I'm building a rails app that users get quotes on rental equipment. A user can have many quotes, but only 1 open quote. A quote can have many quote_line_items and each quote_line_item has the ...
2
votes
0
answers
198
views
Active Admin Formtastic: dynamic has_many inputs without a table?
I'm using Formtastic as part of Active Admin in Rails
I'd like to use the dynamic form builder (adding and removing elements with buttons). Normally this would be done with has_many inputs, but I am ...
0
votes
0
answers
295
views
How to get multiple fields form into one Json column using ActiveAdmin Active Admin Ruby on Rails and MySQL?
Hi I'm new to ActiveAdmin, it's inherent Formtastic and Ruby (2.6) on Rails (6.1) and need to make a modification on an existing system.
To make it short, I have a Prices model, which is filled with ...
0
votes
1
answer
502
views
Rails 6 create custom formtastic input based on existing one
Inside of my ActiveAdmin Rails6 app I've got below partial which replaces the standard input by editor.js (there is some JS magic behind, not relevant to this question). The partial and render look ...
1
vote
1
answer
127
views
is there any way to customize the buttons generated by activeadmin formbuilder
form do |f|
f.inputs "Mission" do
f.input :level
f.input :points
f.input :title
f.input :description
end
f.has_many :requirements do |r|
r.input :...
0
votes
1
answer
224
views
Adding Text in a nested form with ActiveAdmin
When adding nested attributes to an ActiveAdmin form, how can I add a label of a non editable attribute?
f.inputs do
f.has_many :taggings do |t|
t.div :name # t.div is not a method.
t.input ...
1
vote
1
answer
419
views
ActiveAdmin invalid form still submit
In ActiveAdmin I have a form with typed inputs and required fields, and even If I let required fields blank or put numbers in email typed input, I am still able to perform submit even if the form is ...
0
votes
1
answer
296
views
Can't remove :hidden_field from input in ActiveAdmin
I am putting in the input of the ActiveAdmin Formtastic form an array of checkboxes (as: :checkboxes) to later use to populate a ManyToMany intermediary table that is not part of the model itself ...
-3
votes
2
answers
153
views
How to design a database for police fines?
Using Rails 6 I am designing an application to manage police fines. A user can violate many articles, an article can have many letters and a letter can have many commas.
This is my implementation:
#...
3
votes
1
answer
471
views
ActiveAdmin nested has_many
Consider the following models:
class User < ApplicationRecord
accepts_nested_attributes_for :memberships, allow_destroy: true
has_many :memberships, dependent: :destroy
has_many :...
0
votes
1
answer
215
views
Rails unable to change label in formtastic
Hi I'm new to rails and formtastic.
I've built a working solution for multiple file uploads using paperclip.
In my form, when I try and change the label of the upload file it still displays 'image' ...
0
votes
1
answer
486
views
Rails 6 ActiveAdmin dynamic dropdown selection with page reload
I have a following ActiveAdmin form
form do |f|
f.inputs do
f.input :dropdown_a, # Dropdown menu
f.input :dropdown_b, # Dropdown menu
f.input :quantity
f.input :remarks
...
1
vote
1
answer
261
views
Activeadmin: Adding partial to end of index as block
I'm trying to add a modal to my index page by rendering the modal partial onto the page. Whenever I add the partial, it adds it 30 times, 1 for each record displaying. This only occurs when I do index ...
0
votes
2
answers
1k
views
In Active Admin / Arbre form, how I can put HTML (specifically a line break) in a label?
This is a little unorthodox, but I don't think it should be difficult.
I have a Active Admin form:
form do |f|
f.semantic_errors(*f.object.errors.keys)
f.inputs do
f.input :email
f.input :...
0
votes
0
answers
31
views
how to make semantic form visible only to certain roles in ruby?
There are two forms in a custom page, i want to add certain roles to each form to be visible,
eg, SomeForm 1 should be shown if the current user has role profile_manager and SomeForm 2 should be shown ...
1
vote
0
answers
477
views
"undefined method actions" when attempting to create a form using Active Admin
I'm currently trying to create a form using Active Admin with two boolean properties, as defined next:
form do |f|
f.input :only_active, as: :boolean, label: 'Active Only'
f.input :...
7
votes
2
answers
5k
views
How to edit multiple attached images using ActiveStorage `has_many_attached` in ActiveAdmin
I have a simple model that can have multiple images attached via ActiveStorage handling the file storage.
I am using ActiveAdmin to edit my model and to upload/attach the images - so far no problems.
...
0
votes
0
answers
120
views
Formtastic form not submitting - rails 6
I'm trying to create a very simple submitting form inside _form.html.erb file. However, the form is not submitting. If I try to create a new post, after I click submit button, the page just refreshes ...
0
votes
1
answer
212
views
uninitialized constant Formtastic::I18n::SCOPES
Rails 6.0.1, Puma 4.3.0, Devise 4.7.1, ActiveAdmin 2.4.0, Formtastic 3.1.5.
Once again I am creating a Rails application. Created the foundation. A couple of models. Made a simple front-end for them. ...
4
votes
4
answers
2k
views
How do I use rails 6 ActionText fields in an ActiveAdmin form block
I have built a small rails 6 app utilising the new ActionText feature.
However it appears that there is no support in ActiveAdmin for the new field type (rich_text_area)
I have tried using the gem ...
0
votes
1
answer
476
views
Formtastic in activeadmin: Is there a way to create multiple join records with a select input with multiple: true for the associated model?
I've seen many similar questions to this one, but none that quite answer it. I have a form that has an input for a join model. I've successfully created several of these with single inputs, but I'm ...
0
votes
1
answer
679
views
Make jsoneditor in Active Admin read-only through Ruby?
I'm editing a form in Active Admin/Formtastic, which includes a jsoneditor input. Under some circumstances, though, the JSON should be locked and uneditable, in which case I'd want to use the view ...
0
votes
0
answers
139
views
How to disable I18n lookups of Formtastic in activeadmin rails
Using activeadmin in my app which by default uses formtastic, everything works
But the issue I am facing is that in activeadmin page take too much time to load and when I see logs it query on ...
1
vote
1
answer
878
views
text_field_tag with ActiveAdmin
I've a hard time with ActiveAdmin and their DSL. I'm using it to build my admin and at some point in a form I need to have a text_field_tag; I mean some fields which aren't related to the model I'm ...
0
votes
1
answer
872
views
How can I write a form to input a list of text with ActiveAdmin?
I'm writing an ActiveAdmin form for a record which takes an Array of Strings. Let's call them widgets. I'm using a multi select form like so:
ActiveAdmin.register Things do
permit_params widgets[]
...
0
votes
1
answer
685
views
Pre-check multiple checkboxes in Rails ActiveAdmin
I need to pre-check multiple checkboxes in form for habtm model in ActiveAdmin while creating new object. Array with ids of nested model taken from array in third-party model database record. My ...
0
votes
2
answers
491
views
Ruby on Rails and ActiveAdmin: add all object all at once instead add one by one
I'm using Ruby on Rails 5 API app with Active Admin.
I have a model called Subscription with has_many courses (Course is also a model).
When I add courses to a subscription, I need to do it one by ...
0
votes
1
answer
1k
views
Nested form in ActiveAdmin + Formtastic
I want to create a form to generate 1 question with 4 answers. I'm able to create the question no problem, but generating the nested answers isn't working.
To do this, I've created a partial (_newq....
0
votes
1
answer
1k
views
Adding custom form actions in ActiveAdmin
I'm using ActiveAdmin to add google OAuth credentials to a record. The client ID and Client Secret are added via record/1/edit, and I use those to generate a link to allow access. This link appears in ...
0
votes
1
answer
96
views
Passthrough/Temporary Variables in ActiveAdmin
I'm updating an ActiveAdmin page to keep up with a new feature I'm adding to my app, namely Google Sheets Integration. I need a way to capture user input (the auth code from google, copied and pasted ...
0
votes
0
answers
267
views
Rails 5.2: Active Admin Has_One Relations Error
I have model of course, every course has many units, every unit has many videos and has one quiz and finally every quiz has many questions.
When I try to add new course or edit one, this is the error ...
0
votes
1
answer
637
views
Add an image next to a checkbox label in activeadmin form
I am using gem 'activeadmin', '~> 1.3' in a rails app. I have these relationships between two models :
class Offer < ApplicationRecord
has_many :products
end
class Product < ApplicationRecord
...
0
votes
1
answer
738
views
Active Admin form: has_many inputs in separate panels by condition
I am trying to use active admin and formtastic to create a form where reviews of a specific type is edited on a separate panel, currently I render the panels through a .html.erb partial like this:
&...
1
vote
0
answers
847
views
Rails Active Admin base errors - add direct anchor link to the field with error
I have a very long form inside Rails Active Admin.
I would like to customize the base errors messages, that is to say the errors displayed on top of the page (not the ones on each field), so that ...
2
votes
0
answers
283
views
How to have required radio inputs using formtastic
Using Formtastic, I can handle required text inputs, but I can't using required radio inputs.
<%= semantic_form_for(current_user, html: {novalidate: false}) do |f| %>
<%= f.input :name, :...
0
votes
0
answers
137
views
Datalist input type with formtastic is not working
I am using active admin in my application with rails version 3.2.22.2. I am using formtastic version ~> 2.0. I tried to have a text field with autocomplete option, similar to HTML datalist. When I ...
1
vote
1
answer
272
views
Rails undefined method `html_safe' for Formtastic
I am using Formtastic and on a form I have:
<%= f.input :open_date, :as => :string, :input_html => {:class => 'datepicker'}, :start_date => Date.today, label: 'OPEN' %>
Then I ...
1
vote
1
answer
586
views
Rails Active Admin - how to set up a form's with a drop down that includes X choices plus a "free" input
I would like to set up for an Active Admin form a field called field_example (string type), a basic dropdown that would show
option 1
option 2
option 3
freely inputed field
I would like to enable ...
0
votes
0
answers
301
views
ActiveAdmin paginate form inputs has_many
I have something like this:
class Actor < ActiveRecord::Base
attr_accessible :name, :actor_movie_relationships_attributes
validates :name
has_many :actor_movie_relationships, autosave: ...
4
votes
4
answers
2k
views
How to avoid N+1 Query and Perform Eager Loading on Active Admin Form
I am experiencing an N+1 query problem in an Active Admin (Formtastic) form. The query occurs when loading a select input that corresponds to a belongs_to association. The display_name on the ...
0
votes
3
answers
557
views
add formtastic-bootstrap styles to formtastic 3
I have an input that looks like this:
<%= f.input :email %>
The output I get from formtastic(v3.1.5) and rails(v4.2) looks like this.
<li class="email input required stringish" id="...
1
vote
0
answers
503
views
Use activeadmin-ajax_filter gem in nested forms
I'm using ActiveAdmin for an admin panel. In the nested form, I need to use some filtering, for example, in the dropdown I need to select an option name, and in the second dropdown should be displayed ...
1
vote
1
answer
770
views
Is there any way to use formtastic in activeadmin batch action form?
According to activeamdin document, we can do:
batch_action :flag, form: {
type: %w[Offensive Spam Other],
reason: :text,
notes: :textarea,
hide: :checkbox,
date: :datepicker
} do |ids, ...
0
votes
1
answer
75
views
How to create a Formtastic input consisting of two parts?
I want to create a GeographyInput, which will have a textfield for latitude and a textfield for longitude. The result must be pieced together in the form of "POINT (#{longitude}, #{latitude})" (for ...
7
votes
3
answers
7k
views
required input in activeadmin form not working
I am using active_admin. I am trying to make a form field required in activeadmin:
input :team, as: :select, required: true, collection: Team.all.pluck(:name, :id), include_blank: "Please enter a ...
9
votes
1
answer
11k
views
Formtastic/ActiveAdmin set a default value for a select input
I am working on a custom form in ActiveAdmin which I decided to use it for adding/editing to follow the DRY principle so I need to populate it if the user uses it for editing a record ( which isn't a ...