markInvalid([name], [message) can not be used on a form if called from within a $obj rule. The call is silently ignored. This may be required for some validation requirements.
The $obj key specifies the validation of the entire data object, but not the particular field. Here's an example os usage and a way to mark invalid some field using this key:
I tried to investigate this further based on you example. The issue occurs if you have a global $obj rule and a rule specific to the property you like to mark invalid. Please see the following example:
If you just press Submit, the pass2 rule will return true but the $obj will mark pass2 as invalid.
From my understanding a field once marked invalid must be kept as invalid during one validate() cycle. So if one validation handler tells that a field is invalid it must stay invalid no matter if any other handled reports success.
I can confirm the issue, fix will be available as part of the next build.
Perfect, thank you very much!
I do encounter the problem still here with the recent version, i have to remove validate/required from the elements to be able to get my markInvalid on $obj rule to work proper. Using Pro 6.2.6, just as sidenote. (You can also see the bug on the snippet above still existing)
We will update the priority of the issue, thank you for reminding.
The fix is likely to get released in the closest major update.
It looks like you're new here. If you want to get involved, click one of these buttons!