formbuilder

Symfony Form Builder calendar does not show on firefox

偶尔善良 提交于 2020-01-06 14:52:33
问题 I have written this form builder form $document = new Document(); $form = $this->createFormBuilder($document) ->add('name', 'entity', array( 'class' => 'ActionaidLrpBundle:Lrp', 'property' => 'location', 'required' => false, 'empty_value' => 'Select Your Location', 'empty_data' => null, 'query_builder' => function(EntityRepository $er){ return $er->createQueryBuilder('u') ->where("u.status = 'active'"); }, )) ->add('createdDate', 'date', array( 'input' => 'datetime', 'widget' => 'single_text'

Recover values select imput related entities doctrine symfony 2

一笑奈何 提交于 2020-01-05 04:03:16
问题 I'm trying to create a form based on my related entities in doctrine by Symfony 2. I have different entities: Tematica, Personal, Hilo, Consultante, Consulta, Consulta_Asignatura and Asignatura. I reach to persist all my data, nevertheless have some problems with entities Hilo Personal and Tematica. In my form need to show select imput, it should have all "Enunciado" rows and later recover Email of selected option in this select input. I'll share my code, I hope somebody can help my. class

Render a filtered checkbox collection in a form

老子叫甜甜 提交于 2020-01-05 03:36:42
问题 I want to render a filtered collection as a checkbox list. But i have trouble to get the collection shown. i get "Catchable Fatal Error: Object of class Doctrine\ORM\PersistentCollection could not be converted to string". Below is my formtype: class PropertyfilterType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('view', EntityType::class, [ 'class' => Propsearch::class, 'choice_label' => 'propsearchviews', 'expanded' => true,

How to specify HTML attributes for options of a select tag that is created using laravel form builder?

一个人想着一个人 提交于 2020-01-04 01:53:08
问题 You can set HTML attributes for the <select> itself but what about the <options> ? Form::select('name', $options, null, ['class'=>'form-control']) 回答1: First parameter is the id and name attribute, second param is the array with values of <select> , third parameter is selected option and fourth parameter is array with HTML attributes. If you want to set name , class or another HTML attribute simply put it into the array (can't set id with the array, must use first param): // View {{ Form:

Displaying simple_form error messages in top <div>

萝らか妹 提交于 2020-01-01 02:25:06
问题 I have the following two _forms: user form <%= simple_form_for(@user, :url => @target) do |f| %> <% if @user.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2> <ul> <% @user.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <%= f.input :email, :label => "User Email" %> <%= f.input :password, :label => "User Password" %> <%= f.input :first_name %> <%= f.input :last

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

谁说胖子不能爱 提交于 2019-12-29 18:39:08
问题 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 can do it using other methods but I was wondering if it's possible using FormBuilder Validators. If I add "Validators.required" then all 3 fields are required. Any suggestions or ideas? phone: this._fb.group( { other: [''], personal: [''], mobile: [''],

angular6 中怎样创建响应式表单?

霸气de小男生 提交于 2019-12-28 22:12:26
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 在angular中,提供了两种创建表单的方式: 模板驱动型表单(Template Driven Forms) 响应式表单(Reactive Forms) 在模板驱动型表单中,我们直接通过 ngModel 指令在组件模板中创建 control 和绑定数据,不用创建控件、表单对象或编写代码来处理组件类和模板之间的数据交流;并且,我们不会把表单验证写在组件类中。 在响应式表单中,我们在组件类中创建表单对象,并将其绑定到模板中的响应式表单控件中。所有的表单控件和数据验证都写在组件类中;表单验证和表单状态变化是异步的,我们可以在组件类写代码中观察到这一点。响应式表单通常用于数据模型确定的情形。 那么这两种创建表单的方式主要区别在哪里呢? 在响应式表单中,我们不需要用到ngModel,required等指令,我们在组件类中创建所有的控件和验证器。它很容易测试和维护。接下来,我将通过FormControl/FormGroup/FormBuilder/FormArray和添加一些表单验证功能来创建一个响应式表单。 step1: 添加响应式表单模块:Reactive Forms Module import {ReactiveFormsModule} from '@angular/forms'; import {

Symfony 2 - how to pass data to formBuilder?

旧城冷巷雨未停 提交于 2019-12-28 01:57:16
问题 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 = $em->getRepository('VendorMyBundle:Group')->getUserGroups($user); $form = $this->createForm(new Message($groups), $message); /.../ so, what now? how to use it in formBuilder? how to change this line to use passed array of groups? ->add('group','entity'

Show/Hide based on Dropdown selection in knockoutJS with model inside another model

喜你入骨 提交于 2019-12-25 08:29:39
问题 I am working on "Rules" for form builder. I want to show/hide text box based on the dropdown selected. For example, let us assume we have a following "Rules" for a "TextField" control under "Form Builder" Rule# Control(dropdown) Condition(dropdown) Value(as input textbox) 1 TextBox_1 Is filled out (Text Input NOT REQUIRED) 2 TextBox_2 Contains Hi From the above, for Rule 1, the text input is not required and for Rule 2, Text Input is required. The above is my scenario. What I tried: HTML

ionic 2 ion-select not sending value to formbuilder

本小妞迷上赌 提交于 2019-12-25 04:11:21
问题 I'm using formbuilder in ionic 2 but facing problems with the ion-select directive when using formControlName with it. All the data is being forwarded to firebase where these values are being set. here's an extract from the html <ion-item fromGroupName="carDetails"> <ion-label floating>car make</ion-label> <ion-select #carMake (change)="elementChanged(carMake)" formControlName="carMake"> <ion-option value="ford" selected>Ford</ion-option> <ion-option value="bmw">BMW</ion-option> <ion-option