symfony-forms

(tricky?) validation for a sfWidgetFormChoice form widget in Symfony

I am using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I am writing a registration form, which requires a user to provide a user name. I want to impose the following restrictions on the choice of names: That the name is unique (i.e. is not already in use by someone else The name is not in a list of offensive names, stored in a dat...

An example on how to embed forms in Symfony

I am using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I have a user profile table, which has many other tables linked to it (i.e. user_profile.id is a FK in many other tables. My db schema looks something like this: user_profile: _attributes: { phpName: UserProfile } id: ~ guard_id: { type: integer, foreignTable: sf_guard_us...

Doctrine inheritance. Is there an easy way to get all child classes/tables for using them in a select field in symfony forms?

I just started to use symfony 1.4 and Doctrine. (Used 1.0 - 1.2 + Propel a lot before). I thought to give Doctrine a try, because of the fast and huge Development process in the past. Thanks to jwage ;-) Im using Table Inheritance. This is a small portion of my schema.yml: Articles: columns: id: type: integer(4) primary:...

Symfony forms question (restoring selected value of a dynamically populated sfWidgetFormSelect widget)

I am using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I have developed a form that dynamically populates a select widget with cities in a selected country, using AJAX. Before the data entered on the form is saved, I validate the form. If validation fails, the form is presented back to the user for correction. However, because the c...

Unique IDs for Symfony select_tag() helper

With the select_tag() helper, is there a way to avoid passing an id to the generated element? If not, what do you do when you have the same form several times on a page and you want to keep ids unique? ...

Best practice: joining two templates of two plugins

Hi, i have the a login (sfDoctrineGuardPlugin) and a signin (sfDoctrineGuardExtraPlugin) form. Any advice to join them in the same template? Regards ...

Can't get custom error rendering to work in symfony 1.4

I'm tring to customize error rendering in my form according to this example. Here is my code: if ($this['message']->hasError()) { $error_msg = '<ul>'; foreach ($this['message']->getError() as $error) $error_msg .= "<li>$error</li>"; $error_msg .= '</ul>'; } return $error_msg; but when $this['message'] has error this code retur...

sfJQueryUIPlugin: No Picker for new records

Everyday is a new day with Symfony, but I'm loving it! This morning I installed the sfJQueryUIPlugin. It has very little dependencies & accepts themeRoller styles. However, it has 2 issues: [Feature_Request] There is no way to specify the year range. By default, it shows a 20 year range around the year in the field value. eg. if field v...

sfWidgetFormSchemaFormatter: Format for name of embedded form

Hi, Im trying to create a custom formatter in Symfony 1.4. I have embedded form via $this->embedRelation('User','BasesfGuardUserAdminForm'); Is there a way to format the name of the embedded form 'User'? ...

symfony doctrine:insert-sql - "Couldn't locate driver named mysql" error

hey, I am a newbie in symfony. I am following this joobet tutorial on symfony-project.com, I am on there day 3 http://www.symfony-project.org/jobeet/1_4/Doctrine/en/03 Whenever I type php symfony doctrine:insert-sql, I get the following error: doctrine creating tables Couldn't locate driver named mysql I am using it on WAMP. I have sym...

Symfony forms - remembering a previously selected file

I am using Symfony 1.3.2 on Ubuntu and I have a form that contains several widgets. One widget is the sfWidgetFormInputFile, which allows a user to select a picture. If the form is not valid, I present it again to the user, to correct the erroneous field(s). The problem I am experiencing is that currently, when the foem fails to valida...

Edit primary keys in Symfony auto-generated admin

I need to edit primary keys in several tables. By default, symfony hides primary keys in New/Edit forms. For example, can't edit table 'Tags' with only field 'tag' which is PK. Adding integer ID to this table is not exactly good db design. Thanks in advance for your help. ...

Pass a variable to a Symfony Form

Hi, I am building a web application using Symfony 1.4 and Doctrine for a school and I want to make a very simple form to add a course to a student. The main problem I have is that in the drop down list I only want to show the courses in which the student is currently not enrolled. I already have a function in the model (in Student.cla...

How can I create an "array" element with sfForm?

With Zend_Form I could just set an element as an array and it would render with brackets. Can I achieve the same thing using sfForm in symfony? ...

Adding classes to all form widgets in symfony

Hi everyone, I am trying to find a better way to assign classes to form elements in symfony. Currently, I can't seem to get away from assigning each one manually. ie: $this->widgetSchema['title']->setAttribute("class","fieldInput"); $this->widgetSchema['tag_line']->setAttribute("class","fieldInput"); $this->widgetSchema['description']->...

Symfony - Several form on the same page -> ID issue

Hi folks. I have an issue while displaying several forms of the same model on the same page. The problem is that with the NameFormat, the fields have the same ID : $this->widgetSchema->setNameFormat('display[%s]'); Will display <form class="update_display_form" id="update_display_0" action="/iperf/web/frontend_dev.php/update_display...

Symfony / Doctrine - How to filter form field by property in related model

I have a UserForm class which has a select list populated from a related model (specified by a foreign relationship in the yml) like so: $this->setWidget('report_id', new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Report')))); I'd like to filter the Report objects that come from this relation by one of the...

How to format a join table form to display multiple checkboxes for values from one of the linked tables in Symfony?

Apologies if this is something really simple that I've missed. I have 3 tables and related forms in symfony 1.4 (using Doctrine) for a website for local tradesmen: Profile columns: name: { type: string(255), notnull: true} email: { type: string(255), notnull: true, unique: true } phonenumber: { type: string(255), notnull:...

Rendering same form repeated in Symfony for bulk insert

Hello, I been trying all day to do multiple insert for the same form based on a number and i couldn't go any where with it. I hope someone here would be help me out... am using admin generator on 1.4 doctrine. I have a form which i generated with only two fields. what am trying to do is, based on a number inserted the form will be repea...

Add CSS attributes to Symfony form labels?

Hi, I try to add some css attributes to labels in my custom sfForm but I can't achieve it. In my custom class myForm extends sfForm, I create all textfields dynamically: public function configure() { $widgetFixtures = array(); foreach ($fixtures as $fixture) { $widgetFixtures[$fixture->getId()] = new sfWidgetFormInp...