Validation problem

Validation problem

Hi,

I'm trying to validate a form with on submit if statement, unfortunately this code only pops up platenum label or motornum label depending on which is filled, but if both are not filled, it only shows one.

What's wrong with this code?
  1. // plate number validation on submit
  2.         var formclicked=0;
  3.         $('#reg_addcar').submit(function()
  4.         {
  5.             formclicked=1;
  6.             //validates platenum
  7.             if ($('#motornum').val()==='')
  8.             {
  9.                 $('#vmotornum').show().text('This field is required');
  10.                 return false;   
  11.             }
  12.            
  13.             if ($('#platenum').val() == '')
  14.             {
  15.                 $('#vplatenum').show().text('This field is required');
  16.                 return false;   
  17.             }
  18.            
  19.             //validates if canproceed is false
  20.             if (canproceed == 'false')
  21.             {
  22.                 if ($('#vplatenum').text()==='Plate number already exists')
  23.                 {
  24.                     $('#vplatenum').text('Plate number already exists');
  25.                     $('#vplatenum').show();
  26.                 }
  27.                 return false;   
  28.             }
  29.            
  30.         });