Open mubat opened 6 years ago
What exactly is the problem? Validation and submitting must be two separate actions.
@lubosdz exactly.
But if set forceValidate = true
it actual will be submitting.
I think, will be good if:
$('#form-id').yiiactiveForm('validate');
- only validation$('#form-id').yiiactiveForm('validate', true);
- validation with showing error messages$('#form-id').yiiactiveForm('submit');
- submitting formI don't want to submit form when I call validate
action.
Well, forceValidate
argument was introduced 2 years ago to solve another issue - see:
https://github.com/yiisoft/yii2/blame/02b469e8b6c037a4e028aaeaa52fdb3d9c059f24/framework/assets/yii.activeForm.js#L302
I think, if user trigger
validate
event on Yii form, it shouldn't be submitted? If user want to submit form it triggersubmit
event.it happens if call validate method with
forceValidate = true
:If I was write, it need to disable submitting state after validate. Need add next command at https://github.com/yiisoft/yii2/blob/master/framework/assets/yii.activeForm.js#L404:
Additional info