I have a quick form:
{{> quickForm schema = competitorSchema id = "newCompetitorForm" type = "method" buttonContent = "Save competitor" meteormethod = "insertCompetitor" tid = tournament._id}}
This is a BTW modal surge.
Now, in the method code, I had a defect and I did not specify one of the required fields in the mongo insert operation, so what happened:
- The check on the client side passed (because I filled in all the required field on the form)
- When the actual insertion occurred, collector2 threw a valid error saying that field X is missing.
This was thrown back to me, and I will catch this in my onError: startup like this:
onError: function(operation, error, template) { if(error){ alert(error); } }
It could be any common mistake - for some reason BTW.
The warning is not what I want to use here ... because it is not very nice. Collection2 throws "Error: X required", but I really don't want to parse the string field name, as this sorta fragile tries to match this with the form key, as it seems that X is actually a label.
I can come up with a lot of work around, for example, fill in a special div or add a modal, etc., but I really want the autoform to handle this for me with a general form level check error (and not with a specific key),
Does anyone know if there is a good way built into an automatic form to display the level of a form (rather than a specific error) for the user? I did not see this in the docs.
I see how I can use addInvalidKeys etc. for a specific field, but what I want to do is use something like addInvalidKeys without a key so that it displays a level error message, etc.