Skip to main content

I have a page which can create a new Account, Contact and Task (Log a Call) all within the same screen.

The Account and Contact fields both have required fields.  I have the main Save button wired to all three models.

I would like to give the user the option of creating one or all three new records. Is it possible to only apply the Required fields requirement if the model is not blank? Currently if a user fills fields for company, decides that is all that is currently important, and clicks save, the user gets an error that a required field is not complete (from the Contact last name, in this example).

Will separating the save button to the three models individually get rid of this behavior? Thats a lot of save buttons!

Thanks,

 Jacob

If separate save buttons are only wired up to a single model, the validation on other models will not be fired.  This would be a way to get around the situation you are having.   (I’d put the save / cancel buttons on the individual field editors so they were better connected to the object being addressed. 

I think you could solve the primary problem with a custom save button.  The Javascript in that button would need to listen to changes on the models and only attempt to save if changes were identified.  


Rob, how would the javascript know which models have been changed?


Same question here. I see that I could save only certain models, but I am unsure of how to notice the change.  It is also not just a change, but that there currently exists a value in one of the model’s fields.  If a user enters a value, changes his mind, and clicks save, I don’t want to attempt saving an empty model.

Thats the real trick, noticing an empty model on the button click.


Changes are shown in the following var model = skuid.model.getModel(‘Account’) ;  model.changes ; but this includes the conditions which tie it to the parent object.


Some variation of this looks promising: https://community.skuid.com/t/how-do-you-update-display-of-data-from-one-model-when-re…


Reply