Your view can run some javascript to prevent submission unless the form is filled out. The javascript event is onsubmit(). Are you using a javascript framework or will you only have bare javascript?
M On Thu, Aug 4, 2011 at 6:49 AM, varai <[email protected]> wrote: > Hi, > > How do I prevent my user from submitting an empty form? > When I do that, I'm getting a HTTP 404 not found error in IE and a > blank page in Firefox. > None of the validation errors are showing up. > > I even tried putting an else stmt in the StudentsController's add > function and that too is not firing. Nothing shows up for > die(debug($this->Student->validationErrors)) either: > > [CODE]if (!empty($this->data)){ > [COLOR="red"]die(debug($this->Student->validationErrors)); [/COLOR] > $student=$this->Student->saveAll($this->data); > > if (!empty($student)) > { > $this->Session->setFlash('Your child\'s admission has been > received. We will send you an email shortly.'); > > $this->redirect(array('controller'=>'pages', > 'action'=>'home')); > > } > else{ > [COLOR="Red"]$this->Session->setFlash(__('Your admission could > not be saved. Please, try again.', true));[/COLOR] > } > } //for if (!empty.... > [/CODE] > > thank you. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
