params.model.save(); adds 2 error messages

Hi I have a page title with a custom save action that calls a JS snippet

params.model.save();

Below the page title, I have a table of the same model data as in the page title.


When I trigger an error by entering too much data in a text field, I get 3 time of the same error Data type too large:

1 is on the field: this is fine.

2 is above the table

3 is below the actions in the page title.


Can you confirm this is the expected behavior from the JS save()? Is there a way to have it only show once between 2 and 3. Ok with it showing on the field.

I also tried and got 3 messages.

params.model.save({callback: function(result){
   if(result.totalsuccess) {
    params.model.updateData();
   } else {
    var pageTitle = $('#InfinityItemPageTitle');
    var infinityEditor = pageTitle.data('object').editor;
    infinityEditor.clearMessages();
    infinityEditor.handleMessages(
     result.messages);
    
   }


Thanks!

Skuid will render the error message once for every component that is tied to the model with the error in it, and will also render it on whatever field is the culprit if you have your editor/table set to do so.
 It sounds like what you’re experiencing is expected behavior.


Thanks! But if you use the Save action in the action framework. You only get 2 in this case. One on the field, which is fine and one below the page title. That is it only renders in the page title of the save action only and on the field level.

If you use save() in JS, it gives you error on all the components tied to the model. I was trying to use the return snippet for conditionally rendering different Save buttons. But the return snippet does not re-evaluate when I update a field in the table. So I had to code the logic in the custom save in JS and trigger a popup or a direct save.

Instead of using a ‘result of a snippet’ to render your save buttons, you could create ui-only formula fields that return true/false, and render your buttons based on those fields. They will update as you change values in the model.

No luck with the UI only fields. It’s not showing up in the model even if I load it on page load. I know it worked before. Also I will need to set the UI only back to false when the conditions change. It wont’ seem to work using this approach.