Update validate form action to be able to only validate the current form step

This commit is contained in:
Andrew Kingston 2021-08-19 12:52:50 +01:00
parent 2f05450d79
commit 9ea255b7bc
2 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script>
import { Select, Label } from "@budibase/bbui"
import { Select, Label, Checkbox } from "@budibase/bbui"
import { currentAsset, store } from "builderStore"
import { getActionProviderComponents } from "builderStore/dataBinding"
@ -20,6 +20,11 @@
getOptionLabel={x => x._instanceName}
getOptionValue={x => x._id}
/>
<div />
<Checkbox
text="Validate only current step"
bind:value={parameters.onlyCurrentStep}
/>
</div>
<style>

View File

@ -64,10 +64,15 @@ const queryExecutionHandler = async action => {
})
}
const executeActionHandler = async (context, componentId, actionType) => {
const executeActionHandler = async (
context,
componentId,
actionType,
params
) => {
const fn = context[`${componentId}_${actionType}`]
if (fn) {
return await fn()
return await fn(params)
}
}
@ -75,7 +80,8 @@ const validateFormHandler = async (action, context) => {
return await executeActionHandler(
context,
action.parameters.componentId,
ActionTypes.ValidateForm
ActionTypes.ValidateForm,
action.parameters.onlyCurrentStep
)
}