-- Naimesh.Trivedi (Gmail) <naimesh.triv...@gmail.com> wrote (on Tuesday, 11 August 2009, 08:01 PM +0530): > What difference would be in performance, if using dojo in a class like : > class Default_Form_Prjhead extends Zend_Dojo_Form and declaring all dojo > elements below it > > against directly using in view - form.phtml as > > <div class="formRow"> > <label for="firstName">First / Last Name: </label> > <input type="text" id="firstName" name="firstName" > dojoType="dijit.form.ValidationTextBox" > required="true" > propercase="true" > promptMessage="Enter first name." > invalidMessage="First name is required." > trim="true" > class="mytextbox.dojoInputField" > style="width: 10em;" > /> > </div> > > According to my knowledge the latter approach using directly in view gives > more control, but not sure of performance. Do I need to custom build my > dojo.js using builder ?
The benefit of using Zend_Dojo_Form and the various Dijits supported in ZF is that you also get server-side error messages and the ability to set the values for free. Without this, you have to hard-code that functionality into your form. That said, my typical pattern lately has been to *prototype* with Zend_Dojo_Form, and then, once I'm happy with the forms, capture them to client-accessible files within my custom JS module. This allows me to both do initial display of the forms from my application views as well as to fetch them dynamically using XHR -- which can be *very* fast. I've then created Dojo helpers that can take a JSON object of form error messages and display them above the form. This leads to a little more work if you need to change forms later, but allows for more flexibility for Ajax applications, as well as better performance (static files versus dynamic PHP files). -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/