webshim.setOptions('forms', { lazyCustomMessages: true, addValidators: true }); //start polyfilling webshim.polyfill('forms forms-ext'); //wait until form-validators are implemented webshim.ready('form-validators', function () { //change default message ('') for the 'dependent' error type webshim.customErrorMessages.dependent[''] = "Please repeat your password"; webshim.customErrorMessages.dependent['de'] = "Bitte wiederholen sie Ihr Passwort."; });
<!-- simply add .ws-validate to your form and you get nice inline form validation --> <form action="#" class="ws-validate"> <div class="form-row"> <div> <input type="password" placeholder="password" id="password" required="" /> </div> <div> <input data-dependent-validation="password" type="password" placeholder="repeat password" /> </div> </div> <div class="form-row"> <input type="submit" /> </div> </form>
div.ws-invalid input { border-color: #c88; } .ws-invalid label { color: #933; } div.ws-success input { border-color: #8c8; } form { margin: 10px auto; max-width: 400px; min-width: 220px; } .form-row { padding: 5px 10px; margin: 5px 0; } label { display: block; margin: 3px 0; } .form-row input { width: 220px; padding: 3px 1px; border: 1px solid #ccc; box-shadow: none; } .form-row input[type="checkbox"] { width: 15px; } }