-
Notifications
You must be signed in to change notification settings - Fork 1.1k
checkValidity
always returns true
on readOnly
forms
#5931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
readOnly
formscheckValidity
always returns true
on readOnly
forms
Have you checked this on later versions? |
Not yet. I am using |
I have made an example using latest RC versions of https://stackblitz.com/edit/vitejs-vite-saq3bv?file=src%2FApp.jsx |
"Constraint validation: If the readonly attribute is specified on an input element, the element is barred from constraint validation." |
Since I manually invoke the |
After review, we don't expect to change or add any feature functionality around this behavior. We are always happy to review any contributions made but we won't be resourcing anyone for this. |
@namti |
@lane-formio We have multi-user collaborated forms. A user can occupy a form at one time. But all users can submit all forms. That requires validating read only forms. Currently, I use a workaround solution. const checkValidity = async (form: FormProps['form'], submission: FormProps['submission']): Promise<boolean | void> => {
if(form){
const el = document.createElement('div');
let instance: any = null;
await Formio.createForm(el, form)
.then((form: any) => {
form.submission = submission;
instance = form;
})
.catch(err => console.error('Failed to initiate the form.', err));
if(instance !== null){
return instance.checkValidity(null, false);
}
}
}; This works but it costs performance. |
@lane-formio I recommend not going away from the web standard. Angular FormControl works exactly the same way where validation is disabled on disabled fields. |
Describe the bug
checkValidity
function always returnstrue
onreadOnly
forms.Version/Branch
4.15.1
To Reproduce
Steps to reproduce the behavior:
readOnly
totrue
checkValidity(submissionJson, true)
readOnly
tofalse
,checkValidity
returnsfalse
as expectedExpected behavior
Returns
false
on invalid forms even they are read only.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: