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 validation

 
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 -> General
View previous topic :: View next topic  
Author Message
KlausWikrist
Smarty n00b


Joined: 27 Apr 2016
Posts: 1

PostPosted: Wed Apr 27, 2016 11:11 am    Post subject: Form validation Reply with quote

Hi. I'm new to smarty and to this forum. I have a problem. I made a form in index.tpl, and in index.php I have my validation. But it doesn't work. How can I make the validation right in php and smarty?


Image one: http://s32.postimg.org/ylshbtw3o/Screenshot_2016_04_27_14_06_36.jpg

Second image. http://s32.postimg.org/uj61qhrcz/Screenshot_2016_04_27_14_06_39.png

PS. I didn't find a better thread to post this in. And i'm sorry if I should have made some more posts before posting a problem. Thank you.[/img]
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Apr 27, 2016 1:21 pm    Post subject: Reply with quote

I don't quite understand your issue.
And next time please show text data as text. There's [code] tag for exactly that use.
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Wed Apr 27, 2016 10:30 pm    Post subject: Re: Form validation Reply with quote

KlausWikrist wrote:
How can I make the validation right in php and smarty?


You don't need php, and you don't need Smarty for validation of your (simple) form Wink.

All you need is HTML5

Code:
<input type="text" name="name" pattern=".{5,10}" required title="5 to 10 characters">
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Apr 27, 2016 10:45 pm    Post subject: Re: Form validation Reply with quote

elpmis wrote:
Code:
<input type="text" name="name" pattern=".{5,10}" required title="5 to 10 characters">

This is not validation, this is browser suggestion.
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Wed Apr 27, 2016 11:19 pm    Post subject: Reply with quote

If the pattern conditions are not met you can't send the form. It does what he wants ...
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Apr 27, 2016 11:25 pm    Post subject: Reply with quote

elpmis wrote:
If the pattern conditions are not met you can't send the form. It does what he wants ...

Most certainly I can. Browser will complain, but send the form anyway. And if I'm not using browser at all, all your form fiddling is meaningless.
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Thu Apr 28, 2016 6:06 am    Post subject: Reply with quote

Before you swing great speeches here and all know better, you'd better answer the question of the thread starter.

THIS is the sense of this forum!!

And he've said he is a Smarty newbie - your arrogance is there not really helpful.

(yes, I'm following all your answers)

Quote:
I don't quite understand your issue.


If you are unable to understand the question, you should mention better.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Apr 28, 2016 12:34 pm    Post subject: Reply with quote

elpmis wrote:
Before you swing great speeches here and all know better, you'd better answer the question of the thread starter.

THIS is the sense of this forum!!

Wrong.
The forum is here so that YOU can find the answer, with other people's help, not being spoon-fed with it.
Spoon-feeding never increase your understanding of the problem.
And OP obviously have at least two problems, that are tangentially related to the question he asked: He don't understand, what form validation means, and he don't understand, what Smarty is, and how it works.
And until he explains that himself to me, I won't believe that he understand both cases.
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 -> General 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