This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Today's Messages (OFF)  | Unanswered Messages (ON)

Forum: symfony 1.1
 Topic: Different validators when adding or editing in admin generator
Different validators when adding or editing in admin generator [message #61679] Tue, 23 September 2008 23:51
okelet  is currently offline okelet
Messages: 13
Registered: September 2008
Location: Águilas, Murcia, España...
Junior Member

Hi

How could I have different validators when creating and editing data in a module generated with the admin generator? I have a model that allows the upload of a file. I need when the object is created the file is mandatory, but not when the object is editing, because the file has been already set. Something similar happens when adding users and their passwords; when the user is created, the password is mandatory, but not when editing it.

Which could be the best solution for this?

Thanks in advance.
 Topic: select built from criteria query - how to set id column values as the array keys?
select built from criteria query - how to set id column values as the array keys? [message #61752] Wed, 24 September 2008 15:34
bigm  is currently offline bigm
Messages: 40
Registered: April 2008
Location: Australia
Member
Hey Guys,

Sorry about the title of the post, I was trying to think of the best way to explain the problem!! Smile

Basically, I have a Criteria() statement which returns me the array of values I want... however I believe the array keys are simply 0, 1, 2, 3 etc... What I want is for the array keys to be the value of the id column in the db where the array value came from...

So instead of my array being :
0 => ABC
1 => DEF
2 => GEF


It might be
54 => ABC
34 => DEF
76 => GEF


I know somewhere I had a SYmfony 1.0 project that worked like this... I remember something I changed made it go form auto generating the array keys from 0 incrementing into using the values of the id field in the DB, but I can't put my hands on it at the moment (maybe ever Laughing) so am hoping someone else knows.

Thanks,
JM

[Updated on: Thu, 25 September 2008 13:41]


Regards,
JM
http://www.symfonynerds.com
 Topic: Submitting forms with AJAX
Submitting forms with AJAX [message #61895] Fri, 26 September 2008 12:12
Clark  is currently offline Clark
Messages: 6
Registered: April 2008
Location: Munich
Junior Member

Hello,
i want to submit a form via ajax. To do this on an elegant way, my forms have their values in an array as this was the preferred way for the new forms-concept.
Problems:
- prototype can serialize the form but PHP can not unserialize.
- i find no way to do the submission by JSON.
I know that i can check every field in the form, but i want a small solution to submit also bigger forms in later times.
Does anaone has a solution for this?
Regards
Chris


Verlange von niemandem mehr, als du selbst zu tun bereit bist.
 Topic: Symfony crud generator's sample form page doesn't insert values. Help needed.
Symfony crud generator's sample form page doesn't insert values. Help needed. [message #61989] Sun, 28 September 2008 04:03
vinay.chilakamarri  is currently offline vinay.chilakamarri
Messages: 1
Registered: September 2008
Junior Member
I've been playing around with the latest symfony framework to get used to building applications with it. I've gone through couple of tutorials in the actual website http://www.symfony-project.org/book/forms/1_1/en/04-Propel-I ntegration

I've followed the exact methodology described to build model layer and was trying to test it with symfony generated CRUD functions. Although I could see the 'Create user' page, the form inserts only password and nothing else! This happens only with the User entity but the other entities work fine. Here is my yaml file:

propel:
person_table:
_attributes: {phpName: Person}
id: ~
firstName: varchar(120)
lastName: varchar(120)
emailID: varchar(120)
loginID: varchar(120)
password: varchar(120)
phoneNumber: varchar(120)

student_table:
_attributes: {phpName: Student}
id: ~
person_id: {type: integer, foreignTable: person_table, foreignReference: id}
birthdate: date
aboutself: longvarchar
interests: longvarchar
friendlist: longvarchar
picture: varchar(130)

Here are the screenshots of the pages:
index.php/fa/916/0/
index.php/fa/917/0/
index.php/fa/919/0/

And I could see this in the logs of my project:

Sep 27 17:59:46 symfony [info] {personActions} Call "personActions->executeUpdate()"
Sep 27 17:59:47 symfony [info] {sfDebugConnection} connect(): DSN: array ( 'compat_assoc_lower' => NULL, 'compat_rtrim_string' => NULL, 'database' => 'SkillTrade', 'encoding' => NULL, 'hostspec' => 'localhost', 'password' => NULL, 'persistent' => NULL, 'phptype' => 'mysql', 'port' => NULL, 'protocol' => NULL, 'socket' => NULL, 'username' => 'root', ), FLAGS: 0
Sep 27 17:59:47 symfony [info] {sfDebugConnection} prepareStatement(): SELECT person_table.ID, person_table.FIRSTNAME, person_table.LASTNAME, person_table.EMAILID, person_table.LOGINID, person_table.PASSWORD, person_table.PHONENUMBER FROM person_table WHERE person_table.ID IS NULL
Sep 27 17:59:47 symfony [info] {sfDebugConnection} executeQuery(): [1.35 ms] SELECT person_table.ID, person_table.FIRSTNAME, person_table.LASTNAME, person_table.EMAILID, person_table.LOGINID, person_table.PASSWORD, person_table.PHONENUMBER FROM person_table WHERE person_table.ID IS NULL
Sep 27 17:59:47 symfony [info] {sfDebugConnection} beginning transaction.
Sep 27 17:59:47 symfony [info] {sfDebugConnection} beginning transaction.
Sep 27 17:59:47 symfony [info] {sfDebugConnection} beginning transaction.
Sep 27 17:59:47 symfony [info] {sfDebugConnection} prepareStatement(): INSERT INTO person_table (PASSWORD) VALUES (?)
Sep 27 17:59:47 symfony [info] {sfDebugConnection} executeUpdate(): INSERT INTO person_table (PASSWORD) VALUES ('test')

Sep 27 17:59:47 symfony [info] {sfDebugConnection} committing transaction.
Sep 27 17:59:47 symfony [info] {sfDebugConnection} committing transaction.
Sep 27 17:59:47 symfony [info] {sfDebugConnection} committing transaction.

It is clearly inserting only password into database. Why is this happening?

  • Attachment: 1.jpg
    (Size: 24.91KB, Downloaded 1554 time(s))

  • Attachment: 2.jpg
    (Size: 32.25KB, Downloaded 1539 time(s))

  • Attachment: 3.jpg
    (Size: 29.27KB, Downloaded 1549 time(s))

 Topic: Remember page which was requested when a login is required first
Remember page which was requested when a login is required first [message #62043] Mon, 29 September 2008 09:24
koolprogrammer  is currently offline koolprogrammer
Messages: 7
Registered: September 2008
Location: India
Junior Member
This can be achieved by the following
1. The user tries to access a page.
2. Checks whether the user is logged-in.
3. If the user is not logged-in, get the request uri, set the referrer and redirect to login action.
4. Set the referrer in login form and then redirect after successful login.

login redirection is inbuilt in symfony
http://www.symfony-project.org/book/1_1/06-Inside-the-Contro ller-Layer#Action%20Security

does it have option to remember URL too? remember the url which requested the login and redirect to that url after login.
 Topic: embed extra fields in a main form
embed extra fields in a main form [message #62057] Mon, 29 September 2008 12:26
rccc  is currently offline rccc
Messages: 22
Registered: June 2008
Junior Member
Hello,

I have a main form ($this->form).

When fill in this form, users can add one or more chrono subform via an Ajax request.

So i would like to parse the $_POST var to check these extra chrono fields for embed them into the main form as the following :


  public function executeEdit($request)
  {
    $this->form = new EntitiesForm(EntitiesPeer::retrieveByPk($request->getParameter('id_ent')));

		/* parser les champs supplémentaires */
		foreach($_POST as $key=>$value)
		{
			if(preg_match('/chrono-\d{1,3}/', $key))
				{
					fire::out($key, ' cle matchée');
					$defaults = array(
										'desc_chrono'=>$value['desc_chrono'],
										'id_ent_chrono'=>$value['id_ent_chrono'],
										'start_chrono'=>$value['start_chrono'],
										'end_chrono'=>$value['end_chrono']
										);
					fire::out($defaults, '$defaults');
					$this->chrono = new ChronosForm($defaults);

					

					$embeded = Entities::increaseEmbeded();
					$this->form->embedForm('chrono-'.$embeded, $this->chrono );

				}
		}

}


But this don't work, no subform are embeded in the main form...

Don't you know how this could be done

thanks by advance.


 Topic: form & pass custom values
form & pass custom values [message #62071] Mon, 29 September 2008 15:26
oni31zuka  is currently offline oni31zuka
Messages: 3
Registered: September 2008
Location: Italy
Junior Member
Hello to everybody, I wish to do this thing:

I start from an URL like this: http://localhost/symfony/web/frontend.php/pp/edit/obj/1171.
In this url I display a form, the user compile the fields, and when I save all this fields in MySQL DB I wish to save also the field 'object' with 1171 as value the one I have in the URL.
How can I do this?
Is better to work in the template (I'm looking how the form['field'] work) or better in actions?
Thanks

[Updated on: Mon, 29 September 2008 15:27]

 Topic: [SOLVED] sfValidatorErrorSchema - custom error messages now appearing as 500 errors
[SOLVED] sfValidatorErrorSchema - custom error messages now appearing as 500 errors [message #62131] Tue, 30 September 2008 13:20
codeandeffect  is currently offline codeandeffect
Messages: 9
Registered: August 2008
Junior Member
Hello all,

I had a fully working 1.1 validation setup for one of my models, using a custom form for which I set validation, defaults, labels etc.

All was working well, so I moved on to look at other areas of my application.

Now I find that my validation errors are being returned as exceptions instead of being handled as part of the re-display of the form. A typical example is:

(I clear the form field and submit), I then see:
Symfony Exception:
[sfValidatorErrorSchema]
title [The Newsletter requires a title]


(if I enter bad characters instead, I see:
Symfony Exception:
[sfValidatorErrorSchema]
title [The Field contains invalid characters.]


The text of the error is my custom validation methods applied on a REGEX validator.

I cannot figure out why these appear to be fully working, but a re returning full-on errors rather than the validation errors and form.

The only change made that could have affected it was to the routing.yml in the app-config folder, but I have disabled this and cleared the cache numerous times with no improvement.

Has anyone seen this before?

---Solution: User stupidity and a bit of confusion:

My action had this...
if ($request->isMethod('post'))
      {
		$this->form->bind($request->getParameter('newsletter'));
 if ($this->form->isValid())
 {
 
 } 
 $newsletter = $this->form->save();
 $this->redirect('newsletters/view?id='.$newsletter->getId());
}

Instead of this...
if ($request->isMethod('post'))
 {
 $this->form->bind($request->getParameter('newsletter'));
 if ($this->form->isValid())
  {
   $newsletter = $this->form->save();
   $this->redirect('newsletters/view?id='.$newsletter->getId());
  } 
}


So my if..isValid executed nothing. This had two side-effects:
1. Valid updates still worked, and nothing looked amiss!
2. When not valid, the form wasn't returned, just an exception containing the results of validation output.

Well worth noting!

I failed to check this because I assumed that valid usage worked ok, and I was looking exclusively for code handling invalid usage.


[Updated on: Tue, 30 September 2008 13:45]

 Topic: sfBrowser generate two request
sfBrowser generate two request [message #62147] Tue, 30 September 2008 18:11
Franck  is currently offline Franck
Messages: 4
Registered: August 2008
Location: France
Junior Member
Hi,

I ve made a simple test:

$browser->get('/user/register');


Can you explain me why does this line generate 2 request ? is it normal ?

 Sep 30 18:04:55 symfony [info] {sfPatternRouting} Connect "/"
 Sep 30 18:04:55 symfony [info] {sfPatternRouting} Connect "/symfony/:action/*"
 Sep 30 18:04:55 symfony [info] {sfPatternRouting} Connect "/:module"
 Sep 30 18:04:55 symfony [info] {sfPatternRouting} Connect "/:module/:action/*"
 Sep 30 18:04:55 symfony [info] {sfFrontWebController} Initialization
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Match route [homepage] for "/"
 Sep 30 18:04:56 symfony [info] {sfWebRequest} Request parameters array ( 'module' => 'default', 'action' => 'index',)
 Sep 30 18:04:56 symfony [info] {sfContext} Initialization
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/symfony/:action/*"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/symfony/:action/*"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/:module"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/:module"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/:module/:action/*"
 Sep 30 18:04:56 symfony [info] {sfPatternRouting} Connect "/:module/:action/*"
 Sep 30 18:04:56 symfony [info] {sfFrontWebController} Initialization
 Sep 30 18:04:56 symfony [info] {sfFrontWebController} Initialization
[...] 
 Sep 30 18:04:56 symfony [info] {sfWebResponse} Send content (56906 o)
 Sep 30 18:04:56 symfony [info] {sfWebResponse} Send content (56906 o)


Thank you

Franck
 Topic: Tasks and freeze
Tasks and freeze [message #62198] Wed, 01 October 2008 15:58
ringhio  is currently offline ringhio
Messages: 54
Registered: August 2008
Member
Hi! I'm working on a new project and I've written a task to do some batch updates. Now I need to know if when I'll freeze the project and deployed it on the shared host I'll can use that task like now in the dev env.

Thanks in advance.
Daniel
 Topic: Why the required option value of sfValidatorAnd is false?
icon5.gif  Why the required option value of sfValidatorAnd is false? [message #62221] Wed, 01 October 2008 20:00
tictocinfo  is currently offline tictocinfo
Messages: 4
Registered: October 2008
Location: Japan
Junior Member
Hello,

I'm trying to upgrade my application from symfony1.0 to 1.1 (actually 1.2).

I think the symfony form framework is beautiful, but I'm just wondering why the required option value of sfValidatorAnd validator is false.

I think it must be true for careless mistake.

I found changeset [9411], but I didn't understand the reason Confused

Could you explain it?

Thanks,
Toc

[Updated on: Wed, 01 October 2008 23:28]

 Topic: Having problems using hydrate
Having problems using hydrate [message #62257] Thu, 02 October 2008 10:45
kjarli  is currently offline kjarli
Messages: 45
Registered: August 2008
Member
Here is my problem:

<?php
class Book extends BaseBook
{
	public function getLocationList()
	{
		$c = new Criteria();
		$c->addSelectColumn(BookPeer::LOCATION);
		$c->setDistinct();
		return $this->hydrate(BookPeer::doSelectRS($c));
	}
}
?>


Using
$this->hydrate(BookPeer::doSelectRS($c)) or
(BookPeer::doSelect($c)
Both result in an exception because the hydrate only recieves one column. How can i make sure that the hydrate works while selecting the distinct BookPeer::LOCATION?

edit: i forgot to mention that i may or may not need all fields (depends on the case)

[Updated on: Thu, 02 October 2008 10:48]

 Topic: Disable javascript for certain request format?
Disable javascript for certain request format? [message #62303] Fri, 03 October 2008 00:24
asutula  is currently offline asutula
Messages: 11
Registered: July 2008
Junior Member
I'm using 1.1's great setRequestFormat() and request-format-specific templates to serve a version of my symfony app for mobile devices (example at http://www.symfony-project.org/blog/2008/06/09/how-to-create -an-optimized-version-of-your-website-for-the-iphone-in-symf ony-1-1).

Both the non-mobile and mobile templates load javascript because they share the same view.yml parameters. This is a problem because many mobile web browsers don't support javascript and don't handle the presence of javascript gracefully.

I'd like for the mobile version of my app not to load any javascript. Is this possible through view.yml or some other method? Should I just specify javascript loading in each template and not use view.yml?

Thanks you,
Aaron
 Topic: Forms: how to obtain a NULL value from a sanitized field
Forms: how to obtain a NULL value from a sanitized field [message #62438] Mon, 06 October 2008 10:01
cestcri  is currently offline cestcri
Messages: 232
Registered: August 2007
Location: Paris
Faithful Member
Hello,


I wonder if it's possible to obtain a NULL value after a form has been validated. I currently have a hidden field with an user id, with should be left empty (=null) when an unlogged user fills in the form. Unfortunately the form validation process changes the null to a 0 (=Integer). I could do a little hack to cope with that, but actually I'd prefer having NULL as user_id for content that has been submitted by unlogged users.


My hidden input field has a simple sfValidatorPass(), is there another validator that lets pass NULL?


Thanks in advance,
Christian
 Topic: How To use Validator in Oracle?
How To use Validator in Oracle? [message #62484] Tue, 07 October 2008 04:55
E3JYK1  is currently offline E3JYK1
Messages: 1
Registered: October 2008
Junior Member
Hello.

I cannot speak much English.
Because this contribution is an automatic translation and performs it, please permit it it even if there is a strange point grammatically.

I was going to use sfPropelUniqueValidator and sfValidatorPropelUnique in the application that I used Oracle for, but did not move well.
These two Validator, Will Field name be written on the premise that is a small letter?

example:sfValidatorPropelChoice(2008-09-17 17:24:18Z) Line:80
$columnName = strtolower($column->getColumnName());

Will not it be why, the following cords?
$columnName = $column->getColumnName();

Or will there be the setting that I forget for Oracle?

Thank you.

postscript:
Symfony is used widely in Japan.
We thank all of you.
 Topic: Problem with installation of plugins with 1.1.3 and 1.1.4
Problem with installation of plugins with 1.1.3 and 1.1.4 [message #62538] Tue, 07 October 2008 17:15
cestcri  is currently offline cestcri
Messages: 232
Registered: August 2007
Location: Paris
Faithful Member
Hi all,


recently I noticed that I cannot install any plugin anymore. They all seem to be written for 1.1.0

Via PEAR...

symfony plugin:uninstall pluginName


...I get the following error:


Unable to get plugin licence information for plugin...


Trying with --force-licence mostly does not work, since this options does not seem to be available in many plugins.


Via download and command line it also does not work:

symfony plugin-install /home/path/to/downloads/pluginName.tgz


I tried this for:

- sfSitemap2Plugin (sfSitemap2Plugin-0.0.2.tgz)
- sfFeed2Plugin (sfFeed2Plugin-0.9.4.tgz)


Any idea what I can do in order to get some plugins installed? I could think of downgrading symfony to 1.1, then installing the plugins, and then upgrading again... but that´s not really elegant Wink

Have a nice day,
Christian
 Topic: Validate pending form fields
icon5.gif  Validate pending form fields [message #62547] Tue, 07 October 2008 18:08
mirko  is currently offline mirko
Messages: 9
Registered: June 2007
Junior Member
Hi, I have a problem with the validation of the new form-system.
My form has two fields and the validation of the first input string depends from the input of the second. But the validators are always indepent from each other.
The second idea was to do it in the old way, but I can't set the error(-text) of a field in the action (like the old setError).
I hope you can understand my problem.

Any Ideas???

Thanks.
Mirko
 Topic: Autocomplete not working with symfony-delivered content: difference in header's content-length found
Autocomplete not working with symfony-delivered content: difference in header's content-length found [message #62566] Tue, 07 October 2008 20:01
cestcri  is currently offline cestcri
Messages: 232
Registered: August 2007
Location: Paris
Faithful Member
Good evening,


I'm about to integrate an autocompleter. So far so good, everything works as expected with a "symfony external" script:


new Ajax.Autocompleter('search','update','http://website/response.php', { tokens: ','} );



The next step, replacing the response.php by a call to a symfony action (which has certainly has-layout off), fails:

new Ajax.Autocompleter('search','update','http://website/event/suggest', { tokens: ','} );


It's not a path problem, Firebug nicely shows me the triggered request, including headers, post and response. Initially the headers look a bit different:

The response header of the "static" results.php:

Date	Tue, 07 Oct 2008 17:47:02 GMT
Server	Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
X-Powered-By	PHP/5.2.5
Content-Length	351
Keep-Alive	timeout=5, max=83
Connection	Keep-Alive
Content-Type	text/html; charset=utf-8


And the one of symfony's action:

Date	Tue, 07 Oct 2008 17:49:21 GMT
Server	Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
X-Powered-By	PHP/5.2.5
Expires	Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control	no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma	no-cache
Content-Length	357
Keep-Alive	timeout=5, max=83
Connection	Keep-Alive
Content-Type	text/html; charset=utf-8


In order to get closer to the working header, I added the following to my action:

header("Cache-Control: ");
header("Expires: ");
header("Pragma: ");


This results now in the following header, which is alsmost identical to the one of the non-symfony response.

Date	Tue, 07 Oct 2008 17:52:14 GMT
Server	Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5
X-Powered-By	PHP/5.2.5
Content-Length	357
Keep-Alive	timeout=5, max=100
Connection	Keep-Alive
Content-Type	text/html; charset=utf-8


The only difference that is left is the Content-length! The action strangely has 6 (bytes?) more in the response... although the content is identical!


This bugs me already for quite a while... and I'm really close to give up on autocompletion via symfony's action.


Any input is highly appreciated!!!

Have a nice evening,
Christian
 Topic: Advanced Admin Generator Plugin for Symfony 1.1 -- where?
Advanced Admin Generator Plugin for Symfony 1.1 -- where? [message #62574] Tue, 07 October 2008 22:12
rekabis  is currently offline rekabis
Messages: 107
Registered: June 2008
Location: Kelowna, British Columbia...
Senior Member
Greetings,

I have looked in the Symfony plugins section for a favourite of mine, the Advanced Administration Generator. This plugin extends the normal Symfony methods to allow separate edit and create actions, as well as a show action that summarizes an entry.

Unfortunately, while the Advanced Admin Generator plugin appears when you filter the plugins for 1.1 compatibility ( http://www.symfony-project.org/plugins/filter?filter[sf_1_1] =on&filter[propel]=on&filter[doctrine]=on&filter [category_id]=&filter[name]=sfAdvancedAdminGeneratorPlug in), the actual page for the plugin ( http://www.symfony-project.org/plugins/sfAdvancedAdminGenera torPlugin) shows that it is 1.0 only. As well, trying to install the plugin fails for me, as Symfony cannot find a compatible plugin with that name in the repository.

Is there a version being adapted for 1.1, or is the 1.0 version it? Has 1.1 been extended to provide the same capabilities, or are the Admin generators the same as for 1.0?
 Topic: login on https
login on https [message #62625] Wed, 08 October 2008 17:12
freemind
Messages: 3
Registered: October 2008
Junior Member
Hi to everybody.
I would like make site with this login mechanism:
1. the site is over http
2. when the user go to login page, this page is over https
3. if login ok then redirect to http with session vars set.


Can you help me?
Thanks

P.S.
Sorry for my english
 Topic: Multiple forms for the various tasks of CRUD
Multiple forms for the various tasks of CRUD [message #62806] Fri, 10 October 2008 16:08
Arkante  is currently offline Arkante
Messages: 12
Registered: August 2008
Junior Member
Hi,

I started using the form of sf1.1. But I have several questions.

The first one concerns n:m relations. Let's imagine I have the following model :

user:
    id:     ~
    name:   { type: varchar(255), required: true }

phone:
  id:
  number:   { type: varchar(255), required: true }
 
user_phone:
  user_id:  { type: integer, foreignTable: user, foreignReference: id, primaryKey: true, onDelete: cascade }
  phone_id: { type: integer, foreignTable: phone, foreignReference: id, primaryKey: true, onDelete: cascade }


I generate the forms and then I use the generate-CRUD (--with-show) task using the User class. I get a module "user".
In the generated form (BaseUserForm.class.php) there are one field for the phones :

'user_phone_list' => new sfWidgetFormPropelSelectMany(array('model' => 'Phone'));


Wonderfull, I can pick the phone I need. BUT ... what if I'm creating a new user (and by the way a new phone) ? I need to change the selectmany into input(s) corresponding to the phone table fields.

How can I do this ? Do I have to use different forms or is there any sfWidgetFormPropelInput ?

Thank you for your help and have a nice day !
 Topic: Tutorial 1.1 : Security question
Tutorial 1.1 : Security question [message #62893] Sat, 11 October 2008 21:35
daok  is currently offline daok
Messages: 11
Registered: October 2008
Junior Member
Why is the login admin/password?

I do not see anywhere any comparison to string "admin" and "password"? I do not see how to make it works with database too Confused
 Topic: select and input text fields - how to validate?
select and input text fields - how to validate? [message #62928] Sun, 12 October 2008 22:15
onlydust  is currently offline onlydust
Messages: 47
Registered: May 2008
Member
Hello everyone.
May someone help me in my problem?
I have form with 2 fields: one "select" and one "input - type text". In select i have list of values and if in this list isn`t suitable value user can write his value in input field. I need to validate if input field is not empty when user did not select any value from select tag. What may i do this? I tried with PostValidator(i use sf 1.1 forms) but it give me nothing. Any advice, please?
 Topic: Symfony fails to allow edit/create a varchar PK
Symfony fails to allow edit/create a varchar PK [message #62950] Mon, 13 October 2008 11:17
kjarli  is currently offline kjarli
Messages: 45
Registered: August 2008
Member
I have a PK to identify a code:
  available:
    code:         { primaryKey: true, type: varchar(2) }
    value:        varchar(255)


Now i want to be able to edit/create the pk manually, but symfony simply refuses to display it or allow me to edit it in the edit action.

How can i solve this?
 Topic: 1.1 Remote form
1.1 Remote form [message #63045] Tue, 14 October 2008 10:43
viski  is currently offline viski
Messages: 1
Registered: October 2008
Junior Member
Hello,

I am trying to implement something but i am note sure i have the right approach, maybe you can help me:

What i want to do:
Assume i have a page "item" which display numerous things including some "news".

So far it's easy, i just basically do a loop on $item->getNewss() and display what i need.

It's get trickier when i want to edit. Having a link "edit" to something like "news/edit?id=...." works fine. But i want the editing news form to replace the previously displayed content in the loop. Then i want that when clicking on "save" or "cancel" it restore the previous state and update the data if necessary.

What i have done

  1. Created a news/display action which display one news. I have something like.
    ... display of the news ...
    <?php echo link_to_remote('Edit', array(
        'update' => 'news_'.$news->getId(),
        'url'    => 'news/edit?id='.$news->getId(),
    )) ?>
    
  2. In the item/display action, i have something like
    <?php foreach($item->getNewss() as $news) { ?>
    <div id="news_"<?php echo $news->getId() ?>>
    <?php echo javascript_tag(
      remote_function(array(
        'update'  => 'news_'.$news->getId(),
        'url'     => 'news/display?id='.$news->getId()
      ))
    ) ?>
    <?php } ?>
    


So far so good, all the news are displayed and when i click on "Edit", the form is displayed.

Ok now, i need the form to be saved and refreshed, what i have done is:
  1. in the news/edit template, i have something like.
    <?php echo form_remote_tag(array(
        'update'   => 'news_'.$news->getId(),
        'url'      => 'news/update?id='.$news->getId(),
    )) ?>
    ... my form
    </form>
    
  2. in the news action class. in the executeUpdate() method, i have a redirect when everything is done to news/display?id='.$news->getId()


So far, everything works fine.


My issues:


  1. When loading the item/display page, the "news" get displayed in a messy way and nearly randomly, which make loading the page like loading a photoalbum on a 14k modem.
  2. When clicking on edit, it's looking also weirdly, the form appear brutally.
  3. When clicking on save, it's looking also weirdly, the form disappear brutally and get replaced by the other content.


Do you think i am using the right approach to do what i am doing ? I couldn't find anything over the web. It works, but it seems very weird to me.

I don't really like looping on $item->getNewss() and then, when displaying the news, retreiving again the news from the DB. It's making the news loaded from the DB twice. Is there any way to optimise that ?

The form appear brutally etc...
I have tried to use callbacks on blind_down and blind_up. I can make the form appear more smoothly by using callbacks on the "link_to_remote" helper, but i didn't succeed to have the form disappear smoothly when saving or canceling.
 Topic: Bug with propel tasks on frozen projects
Bug with propel tasks on frozen projects [message #63228] Thu, 16 October 2008 09:35
nykacho  is currently offline nykacho
Messages: 87
Registered: July 2007
Member
Hello,

I'm running under 1.1.2 with a default 'unfrozen' project (symfony
libs linked in ProjectConfiguration)
I'm using sfGuardPlugin and several database enabled functional tests.
So far, everything works great.
   $ symfony guard:create-user app user pass
   >> user created


When I freeze my project using :

   $ symfony project:freeze


The same task fail throwing a propel exception :
   $ symfony guard:create-user app user pass

   No connection params set for propel


Functional tests also fail :
   $ symfony test:functional frontend moduleActions

   No connection params set for propel


This problem extends to all propel-enabled tasks.

Is that a bug or do I miss something ?
 Topic: missing model classes in sfCore
missing model classes in sfCore [message #63322] Fri, 17 October 2008 08:40
toddm  is currently offline toddm
Messages: 12
Registered: February 2007
Junior Member
Hi
In symfony 1.0 the sfCore class contained a list of all the classes in my lib/model directory.
Where is that list in symfony 1.1?
I assumed the classes would be found in sfSimpleAutoload or sfAutoload, but when I view a module created by the admin generator and check the class list of both these singletons, I don't see all my model classes.
Where should I be looking?
Todd.
 Topic: [solv]sfContext::getInstance()->getController()->sendEmail('module', ' mySendEmailAction') doe
[solv]sfContext::getInstance()->getController()->sendEmail('module', ' mySendEmailAction') doe [message #63374] Fri, 17 October 2008 18:06
jefferson  is currently offline jefferson
Messages: 27
Registered: November 2007
Junior Member
doesn't work in batch,
sfContext::getInstance()->getPresentationFor('module', ' mySendEmailAction','sfMail' [or 'sfMailView']) doesn't work too

getAction works but i can not send emails that way

the compat modus is on,
there is no error-message,
the script just stops,
the content of mySendEmailAction doesn't atter at all, i can delete the contents of the action or try other one, it doesn't work
on sf1.0 everything worked fine
the batch file is symfony1.1 compliant

Edit:Solved
the batch configuration was false, it was set on prod

[Updated on: Fri, 24 October 2008 16:14]

 Topic: routing dynamic values
routing dynamic values [message #63383] Fri, 17 October 2008 19:07
titomiguelcosta  is currently offline titomiguelcosta
Messages: 12
Registered: June 2007
Junior Member
hi there,

in my symfony 1.1 project, i would like to access the value of some parameters defined in the routing rules itself, for instance:

utilizador_accao_me:
url: /utilizador/:accao/me
param: { module: utilizador, action: "<?php echo sfContext::getInstance()->getRequest()->getParameter('accao') ?>"Me }
requirements: { accao: show | edit | delete }

with this rule, i would redirect to 3 different actions depending on the value of :accao, the only problem is that getRequest() returns NULL.

maybe there is other way around, but what i want to avoid is to define 3 rules for 3 actions when they share the same pattern, only differs the name of the action.

any hint is welcome.
Tito
 Topic: Getting crazy with validating embedForms
Getting crazy with validating embedForms [message #63396] Sat, 18 October 2008 01:01
Arkante  is currently offline Arkante
Messages: 12
Registered: August 2008
Junior Member
Hi everybody,

I try (without success) to make a form using the sfForm 1.1 generator.

My form (about school grades) his linked to a 1:n relation in my model :

  user_grade:
    _attributes: { phpName: UserGrade }
    id: { type: integer, primaryKey: true, required: true, autoIncrement: true }
    name: { type: varchar, size: '40', required: true }
    description: { type: longvarchar }
  user_grade_domain:
    _attributes: { phpName: UserGradeDomain }
    id: { type: integer, primaryKey: true, required: true, autoIncrement: true }
    user_grade_id: { type: integer, required: true, foreignTable: user_grade, foreignReference: id, onDelete: cascade }
    name: { type: varchar, size: '200', required: true }
    description: { type: longvarchar }



What I'd like to make is a main form (corresponding to one of the grades) and its domains. THe idea is to have one single form for every thing concerning a grade.

Here is my code (inspired by That's quality.com) :

 public function executeEdit($request)
  {
    $this->forms = array();
  	$grade = UserGradePeer::retrieveByPk($request->getParameter('id'));
  	$this->form = new UserGradeForm($grade);
  	
    foreach($grade->getUserGradeDomains() as $domain) {
    	$domainForm = new UserGradeDomainForm($domain);
    	$widgets = $domainForm->getWidgetSchema();
    	$widgets['user_grade_id'] = new sfWidgetFormInputHidden();
    	
    	$this->forms[] = $domainForm;
    	$this->form->embedForm('domain_'.$domain->getId(), $domainForm);
    }

    if ($this->getRequest()->isMethod('post'))
    {
      $this->form->bind($this->getRequestParameter('user_grade'));
      if ($this->form->isValid())
      {
      	$values = $this->form->getValues();
      	print_r($values);
      	foreach($this->forms as $form) {
      		$form->getObject()->setName($values[$form->getObject()->getId()]['name']);
      		$form->getObject()->setDescription($values[$form->getObject()->getId()]['description']);
      		$form->getObject()->save();
      	}

        $this->form->updateObject();
      	$this->form->save();
      }
      else {
      	echo "shit";
      }
    }
  }


And finally the template code :

	  <?php foreach($forms as $domainForm) : ?>
	  <table>
		<tr>
		  <th><label for="user_grade_domain_<?php echo $domainForm->getObject()->getId() ?>_name">Name</label></th>
		  <td>
		    <?php echo $form['domain_'.$domainForm->getObject()->getId()]['name']->renderError() ?>
		    <?php echo $form['domain_'.$domainForm->getObject()->getId()]['name'] ?>
		  </td>
		</tr>
		<tr>
		  <th><label for="user_grade_domain_<?php echo $domainForm->getObject()->getId() ?>_description">Description</label></th>
		  <td>
		    <?php echo $form['domain_'.$domainForm->getObject()->getId()]['description']->renderError() ?>
		    <?php echo $form['domain_'.$domainForm->getObject()->getId()]['description'] ?>
		  </td>
		</tr>
	  </table>
	  <p>&nbsp;</p>

	  <?php endforeach; ?>


I didn't change the form generated by default (build-forms). But the form is NEVER valid (isValid() returns false).

Do you have any idea of my mistake ? I tried almost everything I know.

How do you feel about symfony ? It looks so difficult to make easy forms ! It is always very easy to make common apps but if you want some original features it looks impossible...

Thank you for your time.
 Topic: How to change Input-Field Names? (Masking)
How to change Input-Field Names? (Masking) [message #63455] Sun, 19 October 2008 18:27
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
Since the forms are generated from a DB representation where my fields are called "mail" and "password", my fields on the html form are also called in that manner.

But is there way to rename the fields while processed by WidgetForm? I would prefer to rename mail on the html form different but it should be still recognized by the processor as mail and I wont change the database representation of that Smile


Debugging is all I doֻ (if these dots are not in line then your screen is broken)
 Topic: [Problem] Some one Know symfony View render's sequence?
icon4.gif  [Problem] Some one Know symfony View render's sequence? [message #63488] Mon, 20 October 2008 04:27
stc6895  is currently offline stc6895
Messages: 12
Registered: October 2008
Junior Member
Hi,Every Developer!

I would like to know the sequence of symfony view layer.

Because I try to develop a Component Decorator to get the View more beautful and the constuct more flexiable. Such as Tab,Grid,Tree,Panel,SplitContainer...etc

Just Developing like .Net And Flex...

Question 01: sequence of view layer
Question 02: how to get rendered html of partial viewer.

----------------------------------------

Help me....Thank you very much indeed.
 Topic: how to validate input field
how to validate input field [message #63494] Mon, 20 October 2008 09:57
aamir  is currently offline aamir
Messages: 5
Registered: October 2008
Junior Member
Hello All,
I'm using symfony 1.1. My form has a check box, when it is checked, I want to validate next field. I have searched on the forum but don't found any solution. Can I use "sfValidatorSchemaCompare" validator, if yes how can I use it? Or any other advice.

Thank You
 Topic: File upload problem
File upload problem [message #63587] Tue, 21 October 2008 12:34
somu  is currently offline somu
Messages: 9
Registered: September 2008
Junior Member
Hi all,

When i tried to upload image its stored in uploads folder and also web folder.

But i mentioned the upload directory is uploads folder only.

$file->save(sfConfig::get('sf_upload_dir').'/'.$filename);


I don't want to save inside the web folder,need to save only uploads folder. What i need to do.

Please guide me.

Thanks.
 Topic: setPostValidator in subclass' configure()
setPostValidator in subclass' configure() [message #63600] Tue, 21 October 2008 16:42
utocen  is currently offline utocen
Messages: 7
Registered: October 2008
Junior Member
Hi,
I'm trying to add uniqueness validation with something like this:

class CompanyForm extends BaseCompanyForm 
{ 
    public function configure() 
    { 
        // add validators (by not touching the base class) 
          
        // validate the name field with propel database  uniqueness validator 
        if ($this->validatorSchema->getPostValidator()) { 
            $this->validatorSchema->setPostValidator(new sfValidatorAnd(array( 
                $this->validatorSchema->getPostValidator(), 
                new sfValidatorPropelUnique(array('model' => 'company', 'column' => array('name'))) 
            ))); 
        } else { 
            // the base class hasn't got any post validators attached 
            $this->validatorSchema->setPostValidator(new sfValidatorAnd( 
                new sfValidatorPropelUnique(array('model' => 'company', 'column' => array('name'))) 
                )); 
              
        } 
          
    } 
}



The question is, is there a way to simplify the above by not checking for an existing postvalidator that might have been attached to the object? When I remove the if block:
if ($this->validatorSchema->getPostValidator()) 

Symhony complains that setPostValidator cannot have a null element.

TIA.

[Updated on: Tue, 21 October 2008 16:46]

 Topic: multiple step forms
multiple step forms [message #63605] Tue, 21 October 2008 17:24
saganxis  is currently offline saganxis
Messages: 24
Registered: February 2008
Location: Argentina
Junior Member
Hi there, i 'd like to know if the new form Framework has implemented something to handle a multiple step process.

I mean a kind of wizard, in my case of 6 steps, where the user has to complete some information.

Is it fine to store the data in the session or is better in the database????

Thanks
 Topic: can not iterate through formwidget
can not iterate through formwidget [message #63617] Tue, 21 October 2008 21:00
hiousi  is currently offline hiousi
Messages: 1
Registered: October 2008
Junior Member
CustomForm.class.php :
class CustomForm extends sfForm
{

	public function configure()
	{
		$this->setWidgets(array(
			'file1' 			=> new sfWidgetFormInputFile(),
			'file2' 			=> new sfWidgetFormInputFile(),
			'file3' 			=> new sfWidgetFormInputFile(),
		));
        }
}


Action :
public function executeIndex($request)
{
    	$this->form = new CustomForm();
}


Template :
<?php foreach($form as $widget) : ?>
	 <?php echo $widget->renderRow(); ?>
<?php endforeach; ?>


can not iterate through the form object. I am doing something wrong ?

thanks for you help

-Pierre
 Topic: Controller inheritance
Controller inheritance [message #63619] Tue, 21 October 2008 22:09
Personalife  is currently offline Personalife
Messages: 23
Registered: December 2007
Junior Member
Is there a way to do inheritance on the controllers? I've managed to write my own plugin for the view where the view will check if a custom view exists, and if it does not, falls back to the default view.

For example:

Check if the template exists:

/custom/apps/appname/modules/index/template/indexSuccess.php

If not, fall back to:

/apps/appname/modules/index/template/indexSuccess.php

I'd like to do the same for the controller (ie actions.class.php, components.class.php), but it doesn't seem as straightforward like it was for the view.

I've been reading on using filters, and it seems I can probably do something above before sfExecutionFilter hits.

http://www.symfony-project.org/images/book/1_1/F0603.pnghttp://www.symfony-project.org/images/book/1_1/F0603.png

However, I'm unsure how the filters know what to load what at what stage.

Basically, how would I cancel out loading the default controller before it hits sfExecutionFilter to load a custom one?

Edit: Okay, it's not exactly inheritance here, I'm unsure what to describe it as.

[Updated on: Tue, 21 October 2008 22:15]

 Topic: How to render a checkbox seperately?
How to render a checkbox seperately? [message #63693] Wed, 22 October 2008 19:27
Seikilos  is currently offline Seikilos
Messages: 609
Registered: May 2008
Location: Germany
Faithful Member
I know how to create a form, I add some widgets, some validators et voila.
But is there a way to rendere one of the elements distinct from the other?

I would like to render a checkbox in a different way my DivFormatter does.

Of course I know one way, this is writing the single output tags in the template by hand instead of echo $form Smile but I would like to avoid that. Is there a way to extract one element and render that by hand or set another formatter for single widgets?


Debugging is all I doֻ (if these dots are not in line then your screen is broken)
 Topic: how to call to module/action from swf?
icon5.gif  how to call to module/action from swf? [message #63839] Fri, 24 October 2008 10:28
jetbird  is currently offline jetbird
Messages: 8
Registered: September 2008
Location: St.-Petersburg, Russia
Junior Member

What is the best way to call to the module/action from swf (for example, when there is a button pressed) - the use of it's absolute adress?

Confused
Pages (169): [ «  <  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  >  »]

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software