Prevent API from accessing User Input until a button is pressed

Hi

See images below. I have an ‘Input’ that takes a ‘postcode’ and delivers back possible address results (please ignore the formatting of how they are returned) ‘as soon as’ the user starts typing their postcode in the input by calling a Geocoding API.

Note the ‘Search by Postcode’ button does absolutely nothing at the moment, but what I’d like to know, is if there’s a way for the API ‘not’ to be called until the button is pressed?


Thanks in advance for any enlightening responses!

Stephen

Yes, use a regular input (you should also set it to “this input shouldn’t be empty”) and rather than trigger your workflow “when that input’s value is changed”, trigger it on whatever button click you want.

Many thanks Keith. I’ll take that on board and see where I get :slight_smile:

Hi again Keith

I’m still having a few issues on understanding this.

I think I’m just confused as to how to prevent the Repeating Group from auto-calling in the API. Should I be removing the Data Source from the Repeating Group?

Notice the screenshot below which I’ve annotated.

Also notice the second screenshot below which I’ve annotated.

Thanks

Stephen

Set your API call up as an Action, rather than Data, then use a workflow action when the button is clicked to make the API call and set the data in the RG.

1 Like

Thanks Adam. I knew the ‘Use As’ in the API setup was there for a reason but never got to the bottom of it until now. Very enlightening, thank you.

I’ll see how I get on from here.

1 Like

Many thanks to @keith and @adamhholmes for their input on this, the final piece in the jigsaw was understanding when setting up an API that the ‘Use as’ dropdown is incredibly important, where you can set the API to be used as ‘Data’ or an ‘Action’.

For those of you in the same pickle as me (I was close to taking myself in the garden and shooting myself :wink: ), once you’ve set the API up as an ‘Action’ you can then easily use a ‘Workflow’ on the button when it is clicked to call an API (see ‘Plugins’ in ‘Click here to add action’ in ‘Workflow’ section). Once you’ve called it, you can then add a second step in the Workflow to display the results of Step 1 (’ Result of step 1…’ set in the Data Source). I’ve added some images below just to help as I’m not the best at explaining.



1 Like