Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Build a Social Network with Flask Takin' Names Macros

igsm '
igsm '
10,440 Points

How to check if username already exists while registration session is running?

Hey! I have two questions regarding registration process.

1) How to validate a username right after it was entered into the field (before pressing a 'Register' button)? 2) How to check if email is real at all (not fake)?

1 Answer

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Igor.

Don't take my answers for 100% correct (actually they could be 100% wrong :) )

1) I think you will need to do this using JavaScript. That is the main language we use to make pages interactive, so I presume in this case you will need JavaScript + Ajax for the database check. There are plenty of courses here on Treehouse regarding these 2 topics and in particular the ajax one is really involving (you have to know javascript before taking it).

2) I do not have an answer here. I mean, we can check if it has @ and an "email.com" like end but I do not know if there is a way to check if we can check that whatever comes before the @ symbol points to something real (if this is what you mean with your question).

Vittorio

igsm '
igsm '
10,440 Points

Ok. Thanks. Regarding email, there should be a way because I saw such feature on some platforms or websites (e.g. governmental, financial) that the email is checked before the form is submitted.