Pages

Wednesday, April 13, 2011

Handling form widgets in Symfony1.4 With doctrine

When you are using formWidgets you might need to change in
1. BaseTblNameForm.class.php
2. TblNameForm.class.php

Let we see something detailed about these classes
1. BaseTblNameForm.class.php

This class contains a setup function which has
1. All the fileds that are in the table.
2. All the validations of the fields.
3. These class decides the basic bahaviour of the controls ie. input, select, etc,.
4. Basic Validation type can be changed here.

Uses of defining bahaviour of the controls in BaseTblName.class.php
1. When a form is drawn without any configuration then the default bahaviour is displayed.
eg. If you are using a filed gender and control you are using is a dropdown/Raido button, then we can change the behaviour in base class itself since it is not going to change for different templates.

2. TblNameForm.class.php
This is a class which extends BaseTblNameForm.
This class contains a configure function which contains
1. All the configurations of the fields
2. Controls bahaviour can be overwritten.
3. Controls or fields cna be unset here.
4. we can also specify the validations here also
5. Extra fields should be specified here with validations

Uses of defining behaviour of the controls in TblNameForm.class.php
1. We can change the dafult behaviour of the control.
2. Since the behaviour of the controls is overwritten you have to specify the validation schema too accordingly.
3. Adding an extra can be specified here with validation.

Hope this helps someone.........

No comments:

Post a Comment