If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

This solution is taken from here

class ConfirmPasswordWidget(PasswordWidget):

    @classmethod
    def widget(cls, field, value, **attributes):
        password = PasswordWidget.widget(field, value, **attributes)
        password.attributes['_class'] += " span5"
        confirm_id = '%s_confirm' % password.attributes['_id']
        confirm = INPUT(**dict(password.attributes, _id=confirm_id, _name=confirm_id, _placeholder='confirm password', _required="required", _oninput="check(this)"))
        CORE = SCRIPT("""function check(input) {
    if (input.value != document.getElementById('%(_id)s').value) {
        input.setCustomValidity('Password Must be Matching.');
    } else {
    // input is valid -- reset the error message
    input.setCustomValidity('');
    }
}""" % password.attributes, _language="javascript", _type="text/javascript")
        return SPAN(DIV(password, confirm, _class="row-fluid"), CORE)

Related slices

Comments (0)


Hosting graciously provided by:
Python Anywhere