Thanks for the link and the js code for it, this is very helpful.
I think that you will need to activate the same js as when you click on this link in order for the form to show up again. One way you could do that would be to call this js in the body onload event. This should cause this form to appear on the page when the page loads.
To make this only happen when the validations fail you could add a php if statement around the body onload event like this:
<body <?php if(isset($_POST['invalid']) && $_POST['invalid'] == 'true') echo "onload=\"the js code here\"" ?> >
This should get that part of the page to load so long as the js code works correctly. Make sure you get that part working before you attempt to add in the php code.