Support Forum
Having button disabled based on validation is not supported out of the box. But saving/closing editor which has invalid fields should be not possible by default. It looks like a bug to me. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/8976-prevent-task-editor-from-closing-if-there-is-an-invalid-field/details
Pavlo Miklashevych
Sr. Frontend Developer
Sending data to server is not related to the editor closing.
Please reply on the questions below:
1. Do you use autoSync?
2. Do you want to validate data before sending it to the server only,
or you want to validate data in the editor form fields before close the editor?
3. Do you want to prevent data from saving and editor from closing if there are invalid fields? (Doesn't work, see https://app.assembla.com/spaces/bryntum/tickets/8976)
Please explain full scenario with a screenshot to show what exactly you want to achieve.
Validation is done on fields level, please see https://www.bryntum.com/docs/gantt/#Common/widget/Field#property-isValid
Please reply on the questions below:
1. Do you use autoSync?
2. Do you want to validate data before sending it to the server only,
or you want to validate data in the editor form fields before close the editor?
3. Do you want to prevent data from saving and editor from closing if there are invalid fields? (Doesn't work, see https://app.assembla.com/spaces/bryntum/tickets/8976)
Please explain full scenario with a screenshot to show what exactly you want to achieve.
Validation is done on fields level, please see https://www.bryntum.com/docs/gantt/#Common/widget/Field#property-isValid
Pavlo Miklashevych
Sr. Frontend Developer
Hi
1. Do you use autoSync? _ No
2. Do you want to validate data before sending it to the server only,
or you want to validate data in the editor form fields before close the editor? - Both solution will be helpful for me.
3. Do you want to prevent data from saving and editor from closing if there are invalid fields? - Yes
1. Do you use autoSync? _ No
2. Do you want to validate data before sending it to the server only,
or you want to validate data in the editor form fields before close the editor? - Both solution will be helpful for me.
3. Do you want to prevent data from saving and editor from closing if there are invalid fields? - Yes
Ok, so there are 2 problems:
1. Validate data before sync to server.
You can listen to beforesync event on the project, check if your data is valid and return "false" to prevent sync if the data is not valid. https://www.bryntum.com/docs/gantt/#Gantt/model/ProjectModel#event-beforesync
2. Validate fields in TaskEditor to be able to prevent from saving not valid data:
2.1 "Save" button should be blocked in case any of task editor fields is invalid. It's broken. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/8976-prevent-task-editor-from-closing-if-there-is-an-invalid-field/details
2.2 We should support custom fields validation, but we don't have a concept of forms. I've created a feature request to introduce Form class and provide form validation. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/9057-provide-form-mixin-to-support-custom-form-validation/details
Regards,
Pavel
1. Validate data before sync to server.
You can listen to beforesync event on the project, check if your data is valid and return "false" to prevent sync if the data is not valid. https://www.bryntum.com/docs/gantt/#Gantt/model/ProjectModel#event-beforesync
2. Validate fields in TaskEditor to be able to prevent from saving not valid data:
2.1 "Save" button should be blocked in case any of task editor fields is invalid. It's broken. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/8976-prevent-task-editor-from-closing-if-there-is-an-invalid-field/details
2.2 We should support custom fields validation, but we don't have a concept of forms. I've created a feature request to introduce Form class and provide form validation. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/9057-provide-form-mixin-to-support-custom-form-validation/details
Regards,
Pavel
Pavlo Miklashevych
Sr. Frontend Developer
It's not getting invoked since autoSync is false. Please call project.sync() manually after Save.
Pavlo Miklashevych
Sr. Frontend Developer