Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,351
Community Members
 
Community Events
168
Community Groups

Invoking a method from onSubmit

Sudhir I'm New Here Aug 07, 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)); };

 

0 answers

Suggest an answer

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

Atlassian Community Events