Form validations

54 views
Skip to first unread message

Irfan Khan

unread,
Jul 11, 2019, 5:50:58 AM7/11/19
to django...@googlegroups.com
Dear members,
I wanted to validate the form which contains the name, phone number, address,email, etc..,
I have developed and tested it if we give any character it’s saving to database table.so I wanted to validate the every field for example
In name field it should take only alphabets, 
And in phone number field it should take only numbers like 
Can any one please guide me which is best practice to perform 
Thanks in advance 

Jani Tiainen

unread,
Jul 11, 2019, 9:06:45 AM7/11/19
to django...@googlegroups.com
Hi.

Usually you validate user input and by using Forms or ModelForms.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALKGViqQgLhqAzPgG5S-sz4ZdwA2z_q6KeTUQoxtNrzrrA21sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Irfan Khan

unread,
Jul 11, 2019, 1:52:08 PM7/11/19
to django...@googlegroups.com
Yeah currently I do have modelforms but I need to know using regular expression can we done 

Khaleel Ahmed H. M. Shariff

unread,
Jul 11, 2019, 3:26:53 PM7/11/19
to django...@googlegroups.com
Yes you could validate user input using regular expression. Explore the re module. 
Best of luck 
God Bless 

Charles Wright

unread,
Jul 11, 2019, 4:15:12 PM7/11/19
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages