views:

767

answers:

5

Hi,

I'm looking for a simple-to-learn php framework for an application that is being migrated from Access to PHP. The application has lots of forms (sometimes 50+ fields per page), and lots of the fields are inter-dependent (ie, you change one field, it updates some other fields or options).

Is there any good php framework for this? I would prefer it really simple since:

  • The devs are not so experienced
  • The DB is being migrated from Access and was not designed with OOP in mind, it's basically a collection of tables divided by functionality, so I probably don't need any ORM (at least for now).

The most important thing is really the ease of form design and fields correlation (ex: two list boxes where the values of the second depends of the selected value of the first) - I know most ajax libs have some support for this but I would like it out of the box.


edit: As a clarification, the most important is not the ajax nifty stuff, although it is important. The important is a straightforward way to create db-based forms. The db is not designed with an ORM in mind, so I don't need fancy table associations on the ORM layer whith cascade deletes etc. If an ORM layer doesn't get in the way and simplifies the implementation so that's ok but i doubt this will ever be true.

+2  A: 

Have a look at Zend Framework, in particular, Zend_Form.

It is enterprise ready, has excellent beginner to advanced tutorials as well as 'official' training courses, and it's free.

You also might want to check out CodeIgniter

karim79
What does "enterprise ready" mean? Expensive? ;)
Pies
@Pies, lol, no, it means good enough for production-serious-business-apps.
karim79
+4  A: 

Code Igniter has some very good documentation regarding forms and handles a lot of the complexities for you.

The form validation class is documented here: http://codeigniter.com/user_guide/libraries/form_validation.html

There is also a form helper class which makes creating forms very easy.

http://codeigniter.com/user_guide/helpers/form_helper.html

It is certainly easier than building a web app from scratch!

Jon Winstanley
+6  A: 

I've just done a similar but much more simple application using codeIgniter, which has a pretty nice form helper

Examples of code:

form_hidden('userName', 'johndoe');
// Would produce: <input type="hidden" name="username" value="johndoe" />

form_input('username', @$_POST['userName'])
// Would produce an input populated with a variable  from the post array

And you can do allsorts using arrays etc:

$js = 'id="shirts" onChange="some_function();"';

echo form_dropdown('shirts', $options, 'large', $js);
jsims281
+4  A: 

While I'll certainly add my support behind the excellent and simple to learn CodeIgniter I fear everyone so far is missing the elephant in the room regarding this question.

To be perfectly honest I don't think any framework is going to make assembling an application with 50+ forms per page simpler or easy for Developers without much experience. Especially with the added requirement of ajax ready support for dropdown dependencies.

Having said that, if you're looking for power and flexibilty I'd slect Zend. If you're looking for straight simplicity I'd choose CodeIgniter.

Steerpike
+1  A: 

I'm a big symfony fan and it has pretty good support for forms with its form helpers. Check out the docs for forms:

http://www.symfony-project.org/book/1_2/10-Forms

Peter D