formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Form Validation

Open 152hq opened this issue 8 years ago • 4 comments

Hi,

Is there a method to trigger form validation manually? like the one which gets triggered on-submit and on-next action. We tried the below snipped

Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example').then(function(form) { form.on('change', function(value) {
console.log(value.isValid); // This will tell you if it is valid. }); var isValid = form.checkValidity(form.submission.data); // Or you can check it manually with. });

Both these values returns true no matter when its called. Can you please some reference to how to achieve this.

Thanks

152hq avatar Nov 20 '18 22:11 152hq

Hello,

This should be working as expected. Could you please send a form embed code of an example of the form where this is not working so we can further investigate?

jeriah-formio avatar Nov 21 '18 21:11 jeriah-formio

Hi,

Please find the below file for reference.

Validate button will check the form validity and display the result on screen. Even when the form is not filled, it will output true.

index.txt

152hq avatar Nov 21 '18 23:11 152hq

Hello,

the .txt file you replied with was empty when I tried to open.

Please send the form embed which can be found on the form within the Form.io portal under the 'Embed' tab https://www.screencast.com/t/LxfwpJgchhV.

Alternatively, you can send a jsfiddle of the issue occurring.

Thanks!

jeriah-formio avatar Nov 23 '18 16:11 jeriah-formio

Hello, the .txt file you replied with was empty when I tried to open. Please send the form embed which can be found on the form within the Form.io portal under the 'Embed' tab https://www.screencast.com/t/LxfwpJgchhV. Alternatively, you can send a jsfiddle of the issue occurring.

jeriah-formio avatar Nov 23 '18 21:11 jeriah-formio