Invoking a method from onSubmit

Sudhir August 7, 2022

We are developing a forge plugin, when are trying to `invoke` a method from a form's on submit, the method gets invoked but we are not getting any response back and instead we see the following error in the browser console.

 

global-bridge.js:1 Uncaught Error: No handler found for post message response for message: close from https://poc.atlassian.net in https://tasd7asdc.cdn.prod.atlassian-dev.net/base-c1arsdf4d/modal/index.html

The same invoke works from any useEffect /form load methods.

Is using invoke not supported from button or form events?

 

code extract:

<form className="form" onSubmit={onSubmit}>
   <label for="uid"><b>ID :  </b></label>
   <input type="text" placeholder="Enter Id" name="uid" required />
   <button type="submit" onclick >Trace</button>
   {message}
</form>

// The submit code: import { view, invoke, router } from '@forge/bridge';
const onSubmit = async (data) => {
invoke('getDetails', { payload: { id: data.target[0].value }, context: context } ).then((data) => console.log(data)); };

 

1 answer

0 votes
Luana Büschelmann March 15, 2023

I am struggling with the same problem, is there any solution or workaround?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events