Workaround for Zend_Dojo_Form when you render elements individually and dijit.byId() returns 'undefined'

Problem: When you render the form as a whole (i.e: <?php echo $this->form ?>), everything works fine, but when you render each element separate, the zendDijit {"id":"yourFormId","params":{"dojoType":"dijit.form.Form"}} is missing. This causes to break the validation/xhr process, because dijit.byId() returns only an 'undefined' value.

Solution: Go to your View, where you render your form and add the following: