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> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label, Checkbox } from "@budibase/bbui"
import { currentAsset, store } from "builderStore" import { currentAsset, store } from "builderStore"
import { getActionProviderComponents } from "builderStore/dataBinding" import { getActionProviderComponents } from "builderStore/dataBinding"
@ -20,6 +20,11 @@
getOptionLabel={x => x._instanceName} getOptionLabel={x => x._instanceName}
getOptionValue={x => x._id} getOptionValue={x => x._id}
/> />
<div />
<Checkbox
text="Validate only current step"
bind:value={parameters.onlyCurrentStep}
/>
</div> </div>
<style> <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}`] const fn = context[`${componentId}_${actionType}`]
if (fn) { if (fn) {
return await fn() return await fn(params)
} }
} }
@ -75,7 +80,8 @@ const validateFormHandler = async (action, context) => {
return await executeActionHandler( return await executeActionHandler(
context, context,
action.parameters.componentId, action.parameters.componentId,
ActionTypes.ValidateForm ActionTypes.ValidateForm,
action.parameters.onlyCurrentStep
) )
} }