Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Smarty Validate - multi page form with error not displaying

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
swirly
Smarty n00b


Joined: 30 Sep 2009
Posts: 2

PostPosted: Wed Sep 30, 2009 1:30 pm    Post subject: Smarty Validate - multi page form with error not displaying Reply with quote

Hello

I'm using smarty validate for a wizard application and I'm having trouble with multi page form

I've first designed my application using a
SmartyValidate::connect($smarty,true) for each new page

It does work perfectly. When an error is raised, I have a message.

Second, I've read there is a possibility to register all the validators only once.

I do a
Code:
SmartyValidate::connect($smarty,true)

only on first page of the wizard, and the
Code:
SmartyValidate::connect($smarty)

only on the other pages.

Before displaying a template, I use the set_page function

Code:
SmartyValidate::set_page('1');


the validator in template have been modified accordingly :
Code:
{validate page="1" id="test" message="error"}


The validator works great as the Validate function is working the way it is intended.

But... when validating a page with an error, no message is shown. I don't understand the cause.

TIA for reading so far

Laurent C.

BTW :
* the page value in set_page and validate has to be an integer or it can be a string also?
* Is the page field in the form mandatory or just a reminder for the coder?
Back to top
View user's profile Send private message
swirly
Smarty n00b


Joined: 30 Sep 2009
Posts: 2

PostPosted: Wed Sep 30, 2009 1:40 pm    Post subject: A complement Reply with quote

As an exemple, I've made a print_r of session data for a page with an error.

Code:

 [validators] => Array
                (
                    [0] => Array
                        (
                            [field] => slismaster
                            [id] => SLISMASTER
                            [criteria] => isMail
                            [message] => This is not a valid mail adress
                            [trim] =>
                            [empty] =>
                            [halt] =>
                            [transform] =>
                            [page] => 2
                            [valid] => 1
                        )

                    [1] => Array
                        (
                            [field] => local_admin_pw
                            [id] => ADMPW
                            [criteria] => notEmpty
                            [message] => This is not a valid password
                            [trim] =>
                            [empty] =>
                            [halt] =>
                            [transform] =>
                            [page] => 2
                            [valid] =>
                        )
                )

            [is_error] => 1
            [is_init] =>
            [page] => 2
        )
)


As you can see, SmartyValidate :
* Has validated the first field
* Has found the second field is an error
* is_valid returns false
* The page reloads correctly.
But the error message for field 2 doesn't display on screen[/list][/code]
Back to top
View user's profile Send private message
BbErSeRkK
Smarty Rookie


Joined: 04 Jan 2008
Posts: 14

PostPosted: Thu Oct 08, 2009 4:54 am    Post subject: Reply with quote

wild guess, as i just use different form names for pages.

but did you set:
Code:
SmartyValidate::set_page('1');

when you redisplay the page with the error?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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