Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Form not returning errors...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
robdawg
Smarty Rookie


Joined: 15 Jul 2005
Posts: 13

PostPosted: Thu Jul 21, 2005 9:07 pm    Post subject: Form not returning errors... Reply with quote

Here is my PHP Code.

Code:
if (empty($_POST)) {
   SmartyValidate::connect($smarty, true);
   SmartyValidate::register_form('Registration');
    SmartyValidate::register_validator('checkUsername1', 'username', 'notEmpty', false, false, 'trim', 'Registration');
    SmartyValidate::register_validator('checkUsername2', 'username:3:16', 'isLength', false, false, 'trim', 'Registration');
    SmartyValidate::register_validator('checkUsername3', 'username:/^([a-zA-Z0-9])*$/', 'isRegExp', false, false, 'trim', 'Registration');
    SmartyValidate::register_validator('checkUsername4', 'username', 'isValidUsername', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword11', 'password1', 'notEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword12', 'password1:3:16', 'isLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword13', 'password1:/^([a-zA-Z0-9])*$/', 'isRegExp', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword14', 'password1:password2', 'isEqual', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword21', 'password2', 'notEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword22', 'password2:3:16', 'isLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkPassword23', 'password2:/^([a-zA-Z0-9])*$/', 'isRegExp', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail11', 'email1', 'notEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail12', 'email1', 'isEmail', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail13', 'email1', 'isValidEmail', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail14', 'email1', 'isValidEmailDomain', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail15', 'email1:email2', 'isEqual', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail21', 'email2', 'notEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail22', 'email2', 'isEmail', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail23', 'email2', 'isValidEmail', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkEmail24', 'email2', 'isValidEmailDomain', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkFirstName1', 'firstName:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkFirstName2', 'firstName:pixelAuctionsPlusCheck:1:32', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkLastName1', 'lastName:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkLastName2', 'lastName:pixelAuctionsPlusCheck:1:32', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkAddress11', 'address1:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkAddress12', 'address1:pixelAuctionsPlusCheck:1:64', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkCity1', 'city:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkCity2', 'city:pixelAuctionsPlusCheck:1:64', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkState1', 'state:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkState2', 'state:pixelAuctionsPlusCheck:1:64', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkZipCode1', 'zipCode:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkZipCode2', 'zipCode:pixelAuctionsPlusCheck:5:10', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkCountry1', 'country:pixelAuctionsPlusCheck', 'dependsOnEmpty', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkCountry2', 'country:pixelAuctionsPlusCheck:2:2', 'dependsOnLength', false, false, 'trim', 'Registration');
   SmartyValidate::register_validator('checkTermsOfService', 'termsOfService:1:1', 'isRange', false, false, 'trim', 'Registration');
    $smarty->assign('newForm',1);
} else {
   SmartyValidate::connect($smarty);
   SmartyValidate::register_object('registrationValidator',$registrationValidator);
   SmartyValidate::register_criteria('isValidUsername', 'registrationValidator->checkUsername', 'Registration');
   SmartyValidate::register_criteria('isValidEmail', 'registrationValidator->checkEmail', 'Registration');
   SmartyValidate::register_criteria('isValidEmailDomain', 'registrationValidator->checkEmailDomain', 'Registration');
    if(SmartyValidate::is_valid($_POST,'Registration')) {
       SmartyValidate::disconnect();

        // Processing Code Here.

        header("Location: ./register_success.php?registrationSession=".$customer->getRegistrationSession());       
    } else {
        $smarty->assign($_POST);
        $smarty->assign('formProblems',1);
    }
}


Any Ideas?

Thanks.

Robert
Back to top
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Fri Jul 22, 2005 6:47 am    Post subject: Reply with quote

Hi,

Why dont registering some custom validators to simplify your logic?

Bye,
Markus
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP