[symfony-users] Re: Access helper from controller
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 228vit escribió: ... sfLoader::loadHelpers('Url'); $url = url_for('@homepage'); ... Actually, that snippet shouldn't work on 1.2. If you're using sf1.2, you'll have to go with: [php] sfContext::getInstance()-getConfiguration()-loadHelpers(array('Number')); [/php] in order to load the NumberHelper from your controller. Best regards, - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqqT84ACgkQ2jTpOyePgAHNWQCeJvYwnolZ9BPjUTBnWAs4p0Q1 bssAn2D8t5g1J8knYUVr/A7oMUsgOGv5 =eThM -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: generator.yml disable field
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 smellycat37 escribió: charki ezziani : I want to see the field value in my html form... I just want to render it not modiabled... Mr_chon : I try on a field type varchar(30) and it doesn't work too... config: actions: ~ fields: name: {params: disabled=true} list: display: [id, name, weighting, created_at, updated_at, published] filter: class: false #display: [name] form:~ edit: display: main: [published, updated_at, created_at] display: [name, weighting, imported] new: ~ On 9 sep, 15:17, Mr_chon shnd...@gmail.com wrote: Hi, I'm not sure you can use the disabled param for dates. If all you want is to display those dates, you could set their type as plain. your fields part would be like this : fields: created_at: { type: plain } On Sep 9, 12:59 pm, smellycat37 charley.mail...@gmail.com wrote: hi, I try to use the symfony admin generator, do you know how disable a field in a the form? I tried this in the generator.yml file but it doesn't work : config: actions: ~ fields: created_at: {params: disabled=true} updated_at: {params: disabled=true} list: display: [id, name, weighting, created_at, updated_at, published] filter: class: false #display: [name] form:~ edit: display: main: [published, updated_at, created_at] display: [name, weighting, imported] new: ~ Good bye, Actually, those settings now ought to be defined in the Form class you're using in the module.. For example: [php] // In your form's configure() method $this-getWidget('created_at')-setAttribute('disabled', 'disabled'); $this-getWidget('updated_at')-setAttribute('disabled', 'disabled'); // ... [/php] - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqnsBkACgkQ2jTpOyePgAHNOgCfY24IyMx5bQ75c6MO58Gbb4JH PMkAnA1mHDqhF95kAthNZVueqUwbzkL4 =3Xc8 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: How do the *.css from a forms getStylesheets() get on the final web page?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Christian Hammers escribió: Hello I built my own Form (below) but neither the stylesheets nor the JavaScripts get included on the final web page. The form widget itself does work fine. What did I miss? class ncWidgetFormDynDateTime extends sfWidgetFormInput ... public function getStylesheets() { return array('calendar-system.css' = 'all'); } ... } And the indexSuccess.php just does a echo $myform and the layout.yml has all includes: head ?php include_http_metas() ? ?php include_metas() ? ?php include_title() ? ?php include_javascripts(); ? ?php include_stylesheets(); ? link rel=shortcut icon href=/favicon.ico / /head ... It does work if I specify each CSS and JS explicitly in view.yml but if that's neccessary then getStylesheets() would be pretty useless. thanks, -christian- You'll have to add something like this in your template: ?php include_stylesheets_for_form($form) ? ?php include_javascripts_for_form($form) ? Remember that this should be *only* in the template in which you're rendering the form, not in *every* template (i.e. your layout). Best regards, - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqmYJQACgkQ2jTpOyePgAEZ0wCeMCXdXdirmHRLv3D5GQ8EQk45 froAoIV9BYdnUacJBSU/abEwIyEa0/hc =6oEl -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: calendar using new sfWidgetFormDate()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 NairuS escribió: Hello, Try this plug-in: http://www.digitalbase.eu/blog/using-dbformextraplugin-for-datepicker-or-datetimepicker/ Regards NairuS 2009/9/7 krishan milepe...@gmail.com mailto:milepe...@gmail.com Hi Does any one knows how to make javascript calendar available via [new sfWidgetFormDate()] widget? Did many search over web but could not find something useful :( Krishan.g Haven't you tried sfFormExtraPlugin?? http://www.symfony-project.org/plugins/sfFormExtraPlugin - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqk9sgACgkQ2jTpOyePgAGWgwCePj2OOU4Sjan4N9oM20i8636n RPQAnjz4Lg1rtBGjPuK3B7y6LLXAllwr =Qji8 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: date picker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mihai RUSOAIE escribió: Hello all! Can I use sfWidgetFormJQueryDate from sfFormExtraPlugin directly in the template? And maybe disable clicking on some of the days? I need a date picker, but restricted on some days. Is that possible with some plugin/widget, or I have to write one myself? Thank you, Mihai Rusoaie e-Business Consultant Mobile: +40 72 RUSOAIE Web: http://mihai.rusoaie.com You can always use widgets in templates: [php] // In your template // $options is the array of options // and $attributes is the array of attributes, // just like inside your forms. $widget = new sfWidgetFormJQueryDate($options, $attributes); // $name is the desired name for the field, // $default_value is the default value to use for the field. echo $widget-render($name, $default_value); [/php] Best regards, - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqX1z4ACgkQ2jTpOyePgAHUmQCfdoC9XmAleMp3dqXoQC2BIgIY j/UAn2Bx4SL/Wyz0m+bDaDkTIZTZwVyD =kjQ4 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: multiple select in a single DB field
I've never tried this, but you may save the serialized array of selected options in a longvarchar field. I would change sfValidatorChoice and use a custom one that returns the result of php's serialize($values_array). Hope I made myself clear. -- José Nahuel Cuesta Luengo El 27/08/2009, a las 04:09, Mihai Rusoaie mihai.ruso...@gmail.com escribió: Hello! Can I store a multiple select in a single database field? I don't need too many fields in the multiple select (about 5). Is there any way to do this using sfWidgetFormChoice and sfValidatorChoice in Symfony 1.2? If yes, what should be the schema field type and what objects to use? Thank you! Mihai --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony 1.2 propel admin generator hide fields only in edit form
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sid Bachtiar escribió: Hi all, I'm trying to understand the new admin generator for Symfony 1.2 I have a field 'image', and I don't want people to edit it, only when inserting new record. Do I have to create separate form class for this? Sid, you can have inside the form the logic that decides whether or not to show the field: [php] // In your form's configure method // ... if ($this-isNew()) { $this-setWidget('image', new sfWidgetFormXXX()); $this-setValidator('image', new sfValidatorXXX()); } else { unset($this['image']); } // ... [/php] Hope this helps! Best regards - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqXCxQACgkQ2jTpOyePgAGrcQCeJmJTFac6YbPlT5cIPRxMB/Ah Am4AoIrDDmIJ8S2DlfCqnh8/FlJ2Sbr8 =G3c6 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: illegal offset type
Just guessing: are you dealing with complex primary keys on any propel- choice-related table? I think you might be getting an array as an index, when a simple string or number is actually expected. -- José Nahuel Cuesta Luengo El 26/08/2009, a las 06:15, asim nizam asim...@gmail.com escribió: here is my form code class HrTblJobApplicationForm extends BaseHrTblJobApplicationForm { public function configure() { $this-setWidgets(array( 'application_id'= new sfWidgetFormInputHidden(), 'vacancy_id'= new sfWidgetFormPropelChoice (array('model' = 'HrTblJobVacancy', 'add_empty' = false)), 'lastname' = new sfWidgetFormInput(), 'firstname' = new sfWidgetFormInput(), 'middlename'= new sfWidgetFormInput(), 'street1' = new sfWidgetFormInput(), 'street2' = new sfWidgetFormInput(), 'city_id' = new sfWidgetFormPropelChoice (array('model' = 'Cities', 'add_empty' = true)), 'country_code' = new sfWidgetFormPropelChoice (array('model' = 'Countries', 'add_empty' = true)), 'province' = new sfWidgetFormInput(), 'zip' = new sfWidgetFormInput(), 'phone' = new sfWidgetFormInput(), 'mobile'= new sfWidgetFormInput(), 'email' = new sfWidgetFormInput(), 'qualifications'= new sfWidgetFormInput(), 'status'= new sfWidgetFormInput(), 'applied_timestamp' = new sfWidgetFormDateTime(), 'emp_number'= new sfWidgetFormInput(), 'inter_panel_code' = new sfWidgetFormPropelChoice (array('model' = 'HrTblPanels', 'add_empty' = true)), 'created_by'= new sfWidgetFormPropelChoice (array('model' = 'Users', 'add_empty' = true)), 'created_when' = new sfWidgetFormInputHidden (array('default' = date('Y/m/d H:i', time(, 'modified_by' = new sfWidgetFormPropelChoice (array('model' = 'Users', 'add_empty' = true)), 'modified_when' = new sfWidgetFormInputHidden (array('default' = date('Y/m/d H:i', time(, 'hr_tbl_app_education_list' = new sfWidgetFormPropelChoiceMany (array('model' = 'HrTblEducation')), )); $this-widgetSchema-setLabels(array( 'vacancy_id' = 'vacancy_id', 'lastname' = 'Last Name', 'firstname' = 'First Name', 'middlename' = 'Middle Name', 'street1'= 'Street1', 'street2'= 'Street2', 'city_id' = 'City', 'country_code' = 'Country', 'province' = 'Province', 'zip'= 'Zip Code', 'phone' = 'Phone', 'mobile' = 'Mobile', 'email' = 'Email', 'qualifications' = 'Qualifications', 'status' = 'Status', 'applied_timestamp' = 'Applied_timestamp', 'emp_number' = 'Employee Number', 'inter_panel_code' = 'inter_panel_code', )); $this-setValidators(array( 'application_id'= new sfValidatorPropelChoice (array('model' = 'HrTblJobApplication', 'column' = 'application_id', 'required' = false)), 'vacancy_id'= new sfValidatorPropelChoice (array('model' = 'HrTblJobVacancy', 'column' = 'vacancy_id')), 'lastname' = new sfValidatorString(array ('max_length' = 100)), 'firstname' = new sfValidatorString(array ('max_length' = 100)), 'middlename'= new sfValidatorString(array ('max_length' = 100)), 'street1' = new sfValidatorString(array ('max_length' = 100, 'required' = false)), 'street2' = new sfValidatorString(array ('max_length' = 100, 'required' = false)), 'city_id' = new sfValidatorPropelChoice (array('model' = 'Cities', 'column' = 'id', 'required' = false)), 'country_code' = new sfValidatorPropelChoice (array('model' = 'Countries', 'column' = 'id', 'required' = false)), 'province' = new sfValidatorString(array ('max_length' = 100, 'required' = false)), 'zip' = new sfValidatorString(array ('max_length' = 20, 'required' = false)), 'phone' = new sfValidatorString(array ('max_length' = 20, 'required' = false)), 'mobile'= new sfValidatorString(array ('max_length' = 20, 'required' = false)), 'email' = new sfValidatorString(array ('max_length' = 50, 'required' = false)), 'qualifications
[symfony-users] Re: Form input manipulation before validation
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 mintao escribió: I have an input field for an URL. When the form is submittet I'm using sfValidatorDoctrineUnique for this field. But BEFORE the validation I'd like to manipulate the url (host name to lower case, cut off any query strings). Imagine the url http://www.test.com/mysite; is already in the database. When a user tries to submit the following url http://www.Test.com/ mysite/?q=foo I'd like sfValitatorDoctrineUnique to recognize it as a unique violation. What can I do? You might: a) use sfValidatorCallback instead of sfValidatorDoctrineUnique and in the callback function you could clean $value and then return whatsoever sfValidatorDoctrineUnique returns for that clean input. Could be something like this: [php] // In your form's configure() method // ... $this-setValidator('url', new sfValidatorCallback(array( 'callback' = array($this, 'validateUrl'), 'required' = true ))); //... // Outside configure(), declare the callback method public function validateUrl($validator, $value, $arguments) { // Clean $value $clean_value = clean($value); $v = new sfValidatorDoctrineUnique(array( 'model' = 'MyModel', 'column' = 'url' )); return $v-clean($clean_value); } [/php] b) Implement your own sfValidatorBase subclass for doing pretty much the same, but with the benefit of code reuse and modularization. Hope this helps. - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqV1QkACgkQ2jTpOyePgAFtMwCfdbql1LtUoHPOU6W20xOtlJWl mz4AoIquBTvQF3bve3uvstWLk8W+T+Na =DcGt -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: pass default values via constructor in doctrine/propel form
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Łukasz Wojciechowski escribió: Hi folks, Hi scenario: user table with FK to department table. I want to set an hidden field with the FK department id. This id is rietrieved from the context, session, whatever. I don't want to access the sfContext in the form configure. The doctrine/propel form constructor has as first argument the object model and as second argument an option array. Should i use the options array for passing/retrieving/setting the default FK id value during form configuration? What it is the best way to do that with a doctrine/propel form? You can override executeNew() and executeEdit() in actions class where You can set default value for hidden field. I'm not sure if this is the best way. -- Best regards Łukasz Wojciechowski New Generation Software +48 602 214 629 http://www.ngsoft.pl I agree with Lukasz, you can override those actions and add something like this: [php] public function executeNew(sfWebRequest $request) { $myObject = new MyObject(); $myObject-setDepartmentId($this-getUser()-getAttribute('department.id')); $this-form = new MyObjectForm($myObject); $this-my_object = $this-form-getObject(); } [/php] I think that overriding executeEdit is not necessary, as the object has already been saved to the database and it will already have 'department_id' set. - -- José Nahuel Cuesta Luengo Desarrollo | CeSPI - UNLP ncue...@cespi.unlp.edu.ar -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqT2QAACgkQ2jTpOyePgAFMuQCfQ/AdVNcNR6tvBU02uEw1NwZX +ykAn1p6/g9Pk9oCj7jo+TouTl6engoM =aOmo -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---