Jump to content
Larry Ullman's Book Forums

Awesomo

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Awesomo

  1. I would also recommend using HTML5 with something like modernizr for non-supporting browsers. HTML5 lets you specify an input field as required and more input types are catered for such as num, email, tel and url. These additions automatically do some validation on the client side and whilst you need to provide back-up for earlier browsers, it speeds things up for users on modern browsers.

     

    Good point. I've seen that Symfony actually can include HTML5 validation when it generates forms. Other frameworks probably do something similar. See http://symfony.com/doc/current/book/forms.html

  2. Hi

    I have used Javascript and PHP for several months now, but I have yet to use a framework. I'm still a bit unsure about which is the best method for creating my forms. I usually put form validation in both the Javascript and PHP. I'm planning to learn a new framework now, and buy one of Larrys books. Either the Javascript or the Yii book. So the answer to this question will also help guide me towards the right book.

     

    All the PHP frameworks have some method of creating forms. There is a Yii example at http://www.yiiframework.com/doc/guide/1.1/en/form.view

    A form can also be generated using Javascript, and the various Javascript frameworks also have their own ways of generating forms. There is a Knockout.js example at http://knockoutjs.com/examples/contactsEditor.html

    Of course you would need to add some PHP to this to have it store the contacts in a database.

     

    Which method is "best practice"? Javascript seems to provide more flexibility for trendy display techniques, but it would seem to me that PHP would integrate better with the back end database.

    How do you decide upon the code for generating your forms?

    Thanks

    Diarmuid

×
×
  • Create New...