This is implemented as backend validation. when I enter few chars in register form I got error message "Enter a value 6 characters long or more". But user need to click register button to see how many chars required minimum. You mean we can display before that ? maybe when user focuses password-field like real time validation
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We can easily add reusable message for real-time validation in forms by doing some modifications at forge_form.html as per below. And validation logic can be done as extra_js snippet maybe.
forge_form.html is very generic and ends up used in lots of places, so I would prefer doing it only for the PasswordChangeBase/PasswordChangeForm and RegistrationForm forms that need it. And now that I think about it, I think browser validation can do a lot of this for us. minlength and maxlength attributes can be set on the input fields. To do this with easywidgets PasswordField I believe something like this should work:
Of course that's hardcoded numbers, that would change of course.
Then the browser will do the enforcing when they hit submit. If we want to enforce it even sooner, we could try adding JS to call checkValidity or reportValidity on the fields whenever they change.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah I checked forge_form is very generic that's why I told this is reusable ;) . Nice idea with html element default validation tricks. we will only do for password field then. Binding event with password field is okay I mentioned how we can display real-time message. What would you suggest where we can display real-time message?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You mean native browser validation is simply okay or better to extend using checkValidity and reportValidity to display real time message when user is typing password?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Native browser validations on submit is a good first step, at least they dont' have to submit the form then :)
I would say try using checkValidity or reportValidity whenever the password field changes, that will run the browser's own validation again (before submit). That would be nice, but I suspect that in some browsers it might interfere with the user typing. If that happens, then I would suggest displaying our own message right next to the input field, maybe using the "tooltip" javascript widget so it can point right at the field.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is implemented as backend validation. when I enter few chars in register form I got error message "Enter a value 6 characters long or more". But user need to click register button to see how many chars required minimum. You mean we can display before that ? maybe when user focuses password-field like real time validation
Right. One simple option would be to show the requirement right away as plain text. JS realtime validation upon focus would be nice too.
Also checking that the new passwords match each other would be nice.
Hi.. Dave
We can easily add reusable message for real-time validation in forms by doing some modifications at
forge_form.html
as per below. And validation logic can be done asextra_js
snippet maybe.We set
real_valid=True
if we need to enable real time validation for a form widgetWhat would you suggest. going with something like this?
forge_form.html
is very generic and ends up used in lots of places, so I would prefer doing it only for thePasswordChangeBase
/PasswordChangeForm
andRegistrationForm
forms that need it. And now that I think about it, I think browser validation can do a lot of this for us.minlength
andmaxlength
attributes can be set on the input fields. To do this with easywidgetsPasswordField
I believe something like this should work:Of course that's hardcoded numbers, that would change of course.
Then the browser will do the enforcing when they hit submit. If we want to enforce it even sooner, we could try adding JS to call
checkValidity
orreportValidity
on the fields whenever they change.Yeah I checked
forge_form
is very generic that's why I told this is reusable ;) . Nice idea with html element default validation tricks. we will only do for password field then. Binding event with password field is okay I mentioned how we can display real-time message. What would you suggest where we can display real-time message?You mean native browser validation is simply okay or better to extend using
checkValidity
andreportValidity
to display real time message when user is typing password?Native browser validations on submit is a good first step, at least they dont' have to submit the form then :)
I would say try using checkValidity or reportValidity whenever the password field changes, that will run the browser's own validation again (before submit). That would be nice, but I suspect that in some browsers it might interfere with the user typing. If that happens, then I would suggest displaying our own message right next to the input field, maybe using the "tooltip" javascript widget so it can point right at the field.
Merged as part of https://forge-allura.apache.org/p/allura/git/merge-requests/301/
Thanks for this improvement