How to prevent an empty form submission into CakePHP 2.5.2 -


i new cakephp, how can use javascript prevent form being submitted empty, mean fields empty ?

the user hit submit button

i using cakephp 2.5.2

you don't need javascript such minor blank validation stuff. go through validation section.

check out example below:

model: user.php has following validation code email field.

class user extends appmodel {   public $validate = array(    'email' => array(      'required' => true,      'allowempty' => false,      'message' => 'email cannot empty.'      )   ); 

setting required true, , allowempty false job you. also, "message" field acts icing on cake indicates error message shown when validation fails.

peace! xd


Comments

  1. best moving companies in houston

    Glorified Body Helpers
    FRIENDLY. SAFE. RELIABLE

    We Believe That Helping Others Makes The World A Better Place
    HOUSTON'S LOCAL AFFORDABLE MOVERS

    Glorified Body Helpers

    Can Help You…

    Load/unload your moving van, trailer or U-Box container. You rent the equipment-we provide the labor all at an affordable price.

    Pack/unpack your moving boxes

    Rearrange furniture

    Help clean and remove junk

    Pickup and deliver donations to your preferred donation center

    ReplyDelete

Post a Comment

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -