formbuilder

Orbeon Custom metadata at form level

十年热恋 提交于 2019-11-29 18:12:49
I want to configure success message ( successMessageTextBox ) and downloadLink ( linkTextbox ) at form level(meta-data) through formBuilder , so that admin can change and publish it anytime. Also these values can be accessible to properties-local.xml file to configure the success-message . e.g: navigate(uri="{xxf:instance('fr-parameters-instance')//linkTextbox}") success-message(message = "{xxf:instance('fr-parameters-instance')//successMessageTextBox}") Any suggestion would be appreciated!! UPDATE :- 1>MetaData if (exists(xxf:instance('fr-form-metadata')/linkTextbox)‌​) then navigate(uri="

Angular2 FormBuilder: Using 'this' in a custom validator

喜你入骨 提交于 2019-11-29 14:48:38
I'm developing a form using Angular2's FormBuilder with custom validation. Problem: In customValidator I'm using this to access the local object data . I'm getting a undefined error when the validation is executed. It looks like the customValidator is executed in a different object and therefore changing the this reference Question: How can I pass a reference of this to the customValidator? export class Ast { public data:any; public myForm:FormGroup; constructor(private _fb:FormBuilder) { this.data = {foo: "bar"}; } customValidator(c: FormControl) { if (this.data.foo == "bar") { // This line

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

我怕爱的太早我们不能终老 提交于 2019-11-29 05:38:14
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? You would simply set the value in your model or entity to true and than pass it to the FormBuilder then it should be checked. If you have a look at the first example in the documentation : A new task is created, then setTask is executed and this task is added to the FormBuilder. If you do the same thing with your checkbox $object->setCheckboxValue(true); and pass the object you should see the checkbox checked. If it's not working as expected, please get back with

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

好久不见. 提交于 2019-11-29 02:55:17
问题 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( 'class' => 'hidden' ) )) It throws the following error when I choose ->add('parent','hidden') : The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class AppBundle\Entity\FoodAnalytics\Recipe. You can avoid this error by

Generate same form type on same page multiple times Symfony2

我的梦境 提交于 2019-11-29 02:33:07
I'm trying to generate a form type in particular the "ProductLanguageType". I want to generate the ProductLanguageType as many times as the current numbers of existing languages in the Language table. For example if I have (English, French, Russian, Chinese) in the Language table, it would generate 4 ProductLanguageType form on the same page. I would like to know how do I query language table and generate multiple form of the same type on the same page, is the form builder capable of doing it or is there another workaround? Been having some trouble with this for some time now and would be

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

核能气质少年 提交于 2019-11-28 21:11:58
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 fields accordingly. $builder->add( 'description', null, array('label' => 'form.description', 'required' => false) ); Yet only the literal string 'form.description' gets shown, not the expected translation of Add a description. The translation service and the messages.en.yml are loaded correctly as I can call var_dump($this->get('translator')->trans('test

Orbeon Custom metadata at form level

本秂侑毒 提交于 2019-11-28 12:34:52
问题 I want to configure success message ( successMessageTextBox ) and downloadLink ( linkTextbox ) at form level(meta-data) through formBuilder , so that admin can change and publish it anytime. Also these values can be accessible to properties-local.xml file to configure the success-message . e.g: navigate(uri="{xxf:instance('fr-parameters-instance')//linkTextbox}") success-message(message = "{xxf:instance('fr-parameters-instance')//successMessageTextBox}") Any suggestion would be appreciated!!

How to create a form with multiple rows of one entity in Symfony2

时光总嘲笑我的痴心妄想 提交于 2019-11-28 12:20:40
First I've read documents for both Collection Field Type and How to Embed a Collection of Forms ... The example is about one entity (Task) that has one-to-many relation with another entity (Tag), and I understand it, but I can not adapt it to what I want! To make it simpler, let say I have a Task entity, this task entity has some relations with other objects like user and project (each task can have one user and one project) I want to make one form, inside this form a list of Tasks, each task in one row of a table that shows information like task.title , task.startdate , task.user.name , task

Rails AJAX: My partial needs a FormBuilder instance

£可爱£侵袭症+ 提交于 2019-11-28 07:35:38
So I've got a form in my Rails app which uses a custom FormBuilder to give me some custom field tags <% form_for :staff_member, @staff_member, :builder => MyFormBuilder do |f| %> [...] <%= render :partial => "staff_members/forms/personal_details", :locals => {:f => f, :skill_groups => @skill_groups, :staff_member => @staff_member} %> [...] <% end %> Now, this partial is in an area of the form which gets replaces by an AJAX callback. What I end up doing from the controller in response to the AJAX request is: render :partial => "staff_members/forms/personal_details", :locals => {:skill_groups =>

Generate same form type on same page multiple times Symfony2

核能气质少年 提交于 2019-11-27 16:48:24
问题 I'm trying to generate a form type in particular the "ProductLanguageType". I want to generate the ProductLanguageType as many times as the current numbers of existing languages in the Language table. For example if I have (English, French, Russian, Chinese) in the Language table, it would generate 4 ProductLanguageType form on the same page. I would like to know how do I query language table and generate multiple form of the same type on the same page, is the form builder capable of doing it