I have a requirement where I want to control all the validations in the form in the following manner:
- The ‘Save’ button should save the form without running any validations.
- The ‘Submit’ button should save the form after running the validations.
Can this be achieved without writing custom code? If custom code would be needed, how will it look like? Any suggestions would be helpful.
Hi @lkharbanda. Good news! Skuid just released a client-side validations feature so you can run custom validations before save without writing code.
This feature is available in Dubai Update 3+ in API v2.
Here’s a page showing how it works: Skuid Techniques: Form Validation
For how to download sample pages, see the Skuid Skool course:
Import Prebuilt Skuid Pages
Hi @Anna_Wiersema, thank you for your response. Please find my exact requirement below:
We are building a long Digital Form which will have all the fields as Required. There are two cases:
- We want to allow the user to save the partially filled form which they can resume later. This will be done via the ‘Save’ button, so in this case we don’t want any validations to be checked, not even the ones related to the ‘Required’ property on the fields.
- Only when they click the ‘Submit’ button and submit the form for approval, all the validations should be checked including the ones related to the ‘Required’ property on the fields.
Any suggestions to implement this would be very helpful.
Hey @lkharbanda thanks for clarifying that you want to save the record without running validations, and then submit it later with the validations.
Here are some thoughts:
Salesforce Validations (database level): The way Salesforce validations work, they will always be enforced on save. There is no way to save an object without running its validations. If you want to use database level validations, you can create another object or possibly record type for “drafts.” Then your save button would save the draft, and the submit button would convert it to a “real” record and run the validations
Skuid validations (individual page level): If you turn off / minimize validations on the database level, then you could use Skuid’s client-side validation to handle this. You could have a field on the Salesforce object marking each record or draft or not draft and then on the Skuid page conditionally render one form (without validations and required fields) for the draft records. It will still run whatever validations you have on save, so you will need to minimize these. You could have another form that conditionally renders for records that you want to submit, with custom required fields and validation rules defined on the client side. The weaknesses here are that these rules are specific to the Skuid page and you’d have to use page includes or copy and paste XML to use them on an other Skuid page. Also you’d have to have a way to “trigger” the validations… maybe the submit button could update that field marketing the record as draft/not and then that would show the custom form with the validations. From there you can try to save and the validations would be triggered.
I hope these thoughts are helpful as you think through what works best in your use case.
Hi @Anna_Wiersema thank you so much for your suggestions, will have a look to see what works out best