Hi all, I allow users to edit their account settings in a web application. One of the fields is their email address. I put a constraint on the field stating that it should never be empty, null and unique. I came across the situation that a user might want to change her/his email address, the problem is, using SQLFORM, the form and database validation kicks in and notifies the user that the email exists already and cannot be updated even though it is unique and belongs to the user as in:
# snippet TR(TD(T("Email"), _class="label"), INPUT(_name="email", _value = user[0].email, _class = "text_input", requires= [IS_NOT_EMPTY(), IS_NOT_IN_DB(db,'users.email'), IS_EMAIL()])), form.components[0].components[1].components[1].components[0].attributes ['requires'][1].error_message = T("This email address exists already, please choose another") id=db.users.update( email = form.vars.email, password = form.vars.password ) I could, just require that an email is given and not requesting it to be unique, but I think that thats a security risk. I would not like to make extensive and wasteful checks again just for that field. Is there a clean way to allow a user to update her email address only it it does not exist and even if it existed not complain only if it belonged to the user in question before? Thanks Thaanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---