Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Ajax check for unique user name, listing title, etc.

edited April 2013 in Apps

It would be nice if the Form->submit() method could return the reason for failure so we didn't have to say things like "You must enter a valid email, or your email may already be registered."

I was thinking, though, that it might be even better to query the database as soon as they enter a value in a field that's supposed to be unique. What would be the best way to approach that?


  • I just added a $form->invalid with more detail on which validation rule caused the failure, which will likely eventually replace $form->failed, but since it's not integrated with the client-side yet it's not much use I'm afraid.

    You can see at the bottom of js/jquery.verify_values.js which rules aren't supported client-side yet, but I think I'll try to add those via AJAX calls to the server at some point too.

  • Can we use $form->invalid in handlers now? That would be a good start.

  • You could, but you would have to disable the client-side validation by setting $form->js_validation = false in order for it to be seen, since the client-side validation doesn't use it at all and would mostly prevent the form from submitting and receiving the $form->invalid list.

  • The scenario I'm thinking of is the user name is valid but not unique. In that case, it would pass client-side validation but not server-side, and then I could display a helpful message. Wouldn't it be OK to leave client-side validation on in that case?

  • I think you're right. Let me know how it works out.

Sign In or Register to comment.