Same problem I am facing? Ant body have any solution? On Aug 21, 10:52 am, Pascal Messana <[EMAIL PROTECTED]> wrote: > I am facing the same problem. > I just posted on the author page > :http://www.pseudocoder.com/archives/2008/02/17/automagic-javascript-v... > > If you solved this problem, can you post the solution then ? > > Thx > > kaushik a écrit : > > > I am facing problem to integrate 'Automagic JavaScriptValidation > > Helper' in my formvalidation. > > > Here is my model: > > > var $name = 'Category'; > > var $primaryKey = 'categoryId'; > > var $displayField = 'categoryName'; > > > var $validate = array( > > 'categoryName' => array( > > 'too_short' => array('rule' => array('minLength', > > 1),'message'=>'Category Name cannot be empty'), > > 'unique' => array('rule' => array('isUnique'), > > 'message'=>'That Category Name is not available'), > > 'must' => array('rule' => array('minLength', 4), > > 'required' =>true, 'message'=>'Category Name is required'), > > ), > > ); > > > Here is my view: > > > <?=$javascript->link(array('jquery', 'validation'), false);?> > > <? > > $options = array('inline' => 'false','messageId' => 'message'); > > ?> > > <? echo $validation->rules('Category');?> > > > <?php echo $form->create('Category',array('type'=>'file')); ?> > > <table width="95%" > > align="center" class="border" > > cellpadding="5" cellspacing="2"> > > <tr > > class="TDHEAD" bgcolor="#799BE1" style="color:#ffffff"> > > <td > > colspan="3">Add Category</td> > > </tr> > > <tr> > > <td > > colspan="3"><div id="message"></div></td> > > </tr> > > <tr> > > <td > > align="right" valign="top" class="tbllogin">Category > > Name</td> > > <td > > align="center" valign="top" class="tbllogin">:</td> > > > > <td><input name="data[Category][categoryName]" type="text" > > size="40" value="" id="categoryName" class="inplogin"><?=$form- > > >error("Category.categoryName",array('wrap'=>'div'));?></td> > > </tr> > > > <tr> > > <td > > colspan="2"> </td> > > > > <td><input type="submit" value=" Submit "> > > <input type="button" value="Cancel" > > onClick="javascript:window.location='../categories';"></td> > > </tr> > > </table> > > <?php echo $form->end(); ?> > > > After html, it is giving- > > > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > > <title>Test Control Panel</title> > > <meta http-equiv="Content-Type" content="text/html; > > charset=iso-8859-1"> > > <link rel="stylesheet" type="text/css" href="/css/default.css" /> > > <script type="text/javascript" src="/js/jquery.js"></script> > > <script type="text/javascript" src="/js/validation.js"></script></ > > head> > > > <body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" > > marginheight="0" marginwidth="0"> > > ..... > > .... > > <script type="text/javascript">$(document).ready(function(){ $ > > ('form').submit( function() { return validateForm(this, > > rules); }); }); > > var rules = eval({"CategoryCategoryName":[{"rule":"\/^.{1,}$ > > \/","message":"Category Name cannot be empty"},{"rule":"\/^.{4,}$ > > \/","message":"Category Name is required"}]}); > > </script> > > ..... > > .... > > <form id="CategoryAddForm" enctype="multipart/form-data" method="post" > > action="/admin/categories/add"> > > <fieldset style="display:none;"><input type="hidden" name="_method" > > value="POST" /></fieldset> > > .... > > <input name="data[Category][categoryName]" type="text" size="40" > > value="" id="categoryName" class="inplogin"> > > ........... > > <input type="submit" value=" Submit "> > > .... > > </form> > > </body> > > > It doesn't showing any error although the field is blank but required. > > It is also not showing any javascript error also. Moreover for valid > > or invalid entry, the form submission is not occurring. > > > Can anyone help me. Where is the bug in my code? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
