Questions tagged [formbuilder]

A FormBuilder is an application or library used for creating forms. FormBuilders are contained in libraries like Symfony2, AlloyUI, Swing, etc. but can also be used in other Applications to provide the user a possibility for creating custom forms.

General Description and Usage

A FormBuilder is an application or library used for simplyfying form creation and as such is contained in many libraries like Symfony2, AlloyUI, Swing, etc.

Furthermore, a FormBuilder can be part of an application, used to allow users to create custom forms.

Resources

Symfony2 FormBuilder

AlloyUI FormBuilder

Swing FormBuilder

849 questions
67
votes
8 answers

How to set a class attribute to a Symfony2 form input

How can I set the HTML class attribute to a form using the FormBuilder in Symfony2 ? Something like this: ->add('birthdate', 'date',array( 'input' => 'datetime', 'widget' => 'single_text', 'attr' => array( 'class'…
Jean-Philippe Bond
  • 10,089
  • 3
  • 34
  • 60
55
votes
4 answers

Symfony2 file upload step by step

I am still learning Symfony2 and don't understand how to upload a file. Don't worry, I've already checked the documentation. It's really good, but my problem isn't explained in any tutorial. I am looking for guidance on how to upload a file with…
Tyrael
  • 553
  • 1
  • 6
  • 6
38
votes
2 answers

fields_for form builder object is nil

Any way to access a nested form_bulder.object? ## controller @project = Project.new @project.tasks.build form_for(@project) do |f| f.object.nil? ## returns false fields_for :tasks do |builder| builder.object.nil? ## returns true end end
Chap
  • 3,483
  • 1
  • 24
  • 27
36
votes
6 answers

Symfony 2 - how to pass data to formBuilder?

I'm using entity choice list in my form. I want to use only specific entities (in example: only groups that user belongs to) So, in controller, I'm getting these groups, and trying to pass them into formBuider. Controller: /.../ $groups =…
jacobmaster
  • 740
  • 2
  • 7
  • 14
36
votes
4 answers

How do I get the HTML 'name' attribute a rails form builder will generate for a certain field?

When you've got a form field such as this: <%= f.text_field :last_name %> it will generate this in HTML: I'd like to know if there's any way to get the name attribute…
digitalWestie
  • 2,647
  • 6
  • 28
  • 45
30
votes
5 answers

Angular2 FormBuilder Validators: require at least one field in a group to be filled

I have a form where I'm collecting phone numbers (mobile, personal, other). I need to have at least input populated. I'm trying to use Angular2 FormBuilder. After much research I'm having a problem getting my head around this problem. I know I…
Manny
  • 1,034
  • 1
  • 11
  • 16
28
votes
4 answers

How to translate labels in symfony2 forms with messages.en.yml?

I am trying to get translation of form fields to work. I have messages.en.yml in my Bundle's Ressource folder. test: it works form: description: Add a description. I want to build a form in an EntityType which translates the labels of the form…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
25
votes
14 answers

How to render a checkbox that is checked by default with the symfony2 Form Builder?

I have not found any easy way to accomplish to simply check a Checkbox by default. That can not be that hard, so what am i missing?
madc
  • 1,674
  • 2
  • 26
  • 41
22
votes
7 answers

symfony : can't we have a hidden entity field?

I am rendering a form with an entity field in symfony. It works well when i choose a regular entity field. $builder ->add('parent','entity',array( 'class' => 'AppBundle:FoodAnalytics\Recipe', 'attr' => array( …
Sébastien
  • 5,263
  • 11
  • 55
  • 116
22
votes
3 answers

Rails 4 form builder with comprehensive support for Twitter Bootstrap 3

Is there any Rails 4 compatible form builder gem(s) that provide comprehensive support for Twitter Bootstrap 3.0.0 forms? Here's a benchmark for what I'd consider 'comprehensive' support: Support for all 3 layouts (basic, horizontal,…
22
votes
3 answers

Symfony2 - FormBuilder - add a class to the field and input

I want to add a class to certain input or label elements in a Symfony application. I can do something like this in a form on the Twig level:
{{ form_label(form.subject) }} {{ form_widget(form.subject, { 'attr': {'class':…
insertusernamehere
  • 23,204
  • 9
  • 87
  • 126
18
votes
1 answer

Using @ViewChild to get hold of the .nativeElement of an input returns 'undefined'

I created the following form in angular2: import {Component, ElementRef, ViewChild, AfterViewInit} from "angular2/core"; import {Observable} from "rxjs/Rx"; import {ControlGroup, Control, Validators, FormBuilder} from…
XDS
  • 3,786
  • 2
  • 36
  • 56
17
votes
1 answer

Displaying simple_form error messages in top

I have the following two _forms: user form <%= simple_form_for(@user, :url => @target) do |f| %> <% if @user.errors.any? %>

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being…

Jay
  • 3,012
  • 14
  • 48
  • 99
16
votes
4 answers

Expected argument of type "string", "Vendor\NameBundle\Form\EntitynameType" given Symfony 3.0

Because of the problems I had with symfony version 2.7 (404 page error right away after installing a project) I started using Symfony version 3.0. After some minor problems I figured out that "app/console" is replaced by "bin/console". So I'm…
Giesburts
  • 6,879
  • 15
  • 48
  • 85
16
votes
2 answers

Implicit argument passing of super from method defined by define_method() is not supported

In "Agile Web Development with Rails" (third edition) page 537 - 541 it has "Custom Form Builders" code as follows: class TaggedBuilder < ActionView::Helpers::FormBuilder #

#
# <%=…

jaycode
  • 2,926
  • 5
  • 35
  • 71
1
2 3
56 57