visualizer can display form elements and run scripts.
Looking at the visualizer code in the question, it’s trying to submit the form. I do not think that is supported!
Possibly because there would be security implications
. Someone from Postman can provide an official reasoning.
After removing type="hidden" and the JavaScript code to submit the form, I’m able to view it in the visualizer.
With the submit code, I can see it’s being cancelled. I tested using both localhost and an external domain.
Visualizations can be debugged by right clicking on the visualization pane and selecting Inspect visualization

I tested using similar code as @baha-bayar
// Not sure why we need this?
function fixHTML(html) {
const fixedHTML = html.replace(/<input(.*?)>/g, '<input$1 />');
const cleanedHTML = fixedHTML.replace(/onclick=".*?"/g, '');
return cleanedHTML;
}
const htmlContent = pm.response.json().data; // HTML will be inside this field when using postman-echo.com
const fixedHTMLContent = fixHTML(htmlContent);
pm.visualizer.set(fixedHTMLContent);
And using postman-echo.com as follows


