Forge Component
(3)
Published on 2018-12-17 by João Martins
3 votes
Published on 2018-12-17 by João Martins

When I'm trying to use "Try it out", "Authorize" or padlock buttons, the component show me a white screen and a loading animation.


In your example (https://joaomartins-os.outsystemscloud.com/SwaggerUI_Demo) it is possible to reproduce it by using the "Try it out" button.


I have checked the browser console and it has no errors.


Best Regards.

Solution

teresende wrote:

When I'm trying to use "Try it out", "Authorize" or padlock buttons, the component show me a white screen and a loading animation.


In your example (https://joaomartins-os.outsystemscloud.com/SwaggerUI_Demo) it is possible to reproduce it by using the "Try it out" button.


I have checked the browser console and it has no errors.


Best Regards.

Hi,

I've managed to fix this issue, please download the latest version to make use of it.

Just to give you the context of what was happening, the platform always adds the code we build into a <form> and once the swaggerUI script was generating <button>s, by default its behavior was to submit the form and therefore causing this annoying behavior.
To overcome this I've added this script

$(document).on("submit", "form", function (e) {
    e.preventDefault();
    return false;
})

to the SwaggerUI web block to prevent this to happen.

Please let me know if you have any questions.


Cheers,

João


Solution

Hi João,

It works! Thanks for the reply and mainly for the explanation.

Regards,


Tiago


João Martins wrote:

teresende wrote:

When I'm trying to use "Try it out", "Authorize" or padlock buttons, the component show me a white screen and a loading animation.


In your example (https://joaomartins-os.outsystemscloud.com/SwaggerUI_Demo) it is possible to reproduce it by using the "Try it out" button.


I have checked the browser console and it has no errors.


Best Regards.

Hi,

I've managed to fix this issue, please download the latest version to make use of it.

Just to give you the context of what was happening, the platform always adds the code we build into a <form> and once the swaggerUI script was generating <button>s, by default its behavior was to submit the form and therefore causing this annoying behavior.
To overcome this I've added this script

$(document).on("submit", "form", function (e) {
    e.preventDefault();
    return false;
})

to the SwaggerUI web block to prevent this to happen.

Please let me know if you have any questions.


Cheers,

João