Re: User name validation - how to check database to find if a name has already been taken?

2009-10-01 Thread Nicolas Melendez
Thanks Igor.Always is good another point of view. NM On Wed, Sep 30, 2009 at 5:14 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: actually you got it completely wrong. especially as your project, and the number of devs who work on it, grows exceptions are a much more scalable way of handling

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-30 Thread Paul Huang
igor.vaynberg wrote: form { onsubmit() { try { users.persist(getmodelobject()); } catch (usernamealreadyexistsexception e) { error(error.username.exists); } } } -igor Thanks, it works like a charm. I did not know I could show an

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-30 Thread Nicolas Melendez
why do you use an exception for user already exits?Don`t you think that return true/false, could be better? i said that, because if the application start growing, you will have lot of exceptions class. thanks, NM On Wed, Sep 30, 2009 at 4:43 PM, Paul Huang paulhuan...@gmail.com wrote:

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-30 Thread Paul Huang
The AbstractValidator approach is fine, or you can do it the shorter way the Igor showed. Either way, when the page that has the username is submitted, you're going to have to write that record to the database, even if you don't have all the info. The way you wrote the question, I presume

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-30 Thread Igor Vaynberg
actually you got it completely wrong. especially as your project, and the number of devs who work on it, grows exceptions are a much more scalable way of handling errors. 1) the compiler tells you exactly what the exceptions are right off the bat 2) exception class name gives you a clue as to

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-27 Thread Flavius
The AbstractValidator approach is fine, or you can do it the shorter way the Igor showed. Either way, when the page that has the username is submitted, you're going to have to write that record to the database, even if you don't have all the info. The way you wrote the question, I presume you

User name validation - how to check database to find if a name has already been taken?

2009-09-25 Thread Paul Huang
Hello, I would like to get your suggestion about how to validate a user name input by checking if the name has already been taken (exists in the back-end database); and how to show feedback messages right next to the input field if it has. Typically, when a user registers to a website, he needs

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-25 Thread Ryan Gravener
I think you are overcomplicating things. Validate the users input, if two users want the same name within 1 second of each request you probably have bigger problems to deal with. Anyhow, when submit is called, if you get a nonunique exception. Catch in dao/service and throw an exception wicket

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-25 Thread Paul Huang
Ryan Gravener-3 wrote: I think you are overcomplicating things. Validate the users input, if two users want the same name within 1 second of each request you probably have bigger problems to deal with. So you think my current solution (extending AbstractValidator) is OK? But I still

Re: User name validation - how to check database to find if a name has already been taken?

2009-09-25 Thread Igor Vaynberg
form { onsubmit() { try { users.persist(getmodelobject()); } catch (usernamealreadyexistsexception e) { error(error.username.exists); } } } -igor On Fri, Sep 25, 2009 at 9:05 AM, Ryan Gravener r...@ryangravener.com wrote: I think you are