I have opened a custom form with following command:
client.interface.trigger(
'showModal', useTemplate('Title of the Modal', './views/modal.html')
);
I would like to be able to close this form using a submit or cancel button. When the user successfully completes the form I want to close the window. I But other than the built-in ‘x’ I can’t find any way to close it.
I’ve looked thru the github samples and only one I found that comes close (iparams-json-omni-app in Omni-App Samples) has a “closePopup()” method but that must be a custom function because its not found. When I tried to run that sample its missing the openModal() method so looks like its an incomplete sample.
This is the contents of modal.html:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://static.freshdev.io/fdk/2.0/assets/fresh_client.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
<script type="module" src="https://unpkg.com/@freshworks/crayons/dist/crayons/crayons.esm.js"></script>
<script nomodule src="https://unpkg.com/@freshworks/crayons/dist/crayons/crayons.js"></script>
<link rel="stylesheet" href="../styles/styles.css" />
</head>
<body>
<article>
<section>
<h1>Change Start Date</h1>
<fw-datepicker value="2020-05-22" date-format="YYYY-MM-DD"></fw-datepicker>
<fw-button color="secondary" onclick="closePopup()"> Submit </fw-button>
<fw-button color="secondary" onclick="javascript:window.close()"> Cancel </fw-button>
</section>
</article>
</body>
<script src="./../scripts/app.js"></script>
</html>
as mentioned above ‘closePopup()’ does not work.