How to make DIV visible on form submit

Hi,

I am hoping someone on this forum would be able to assist me. I am trying to make a DIV visible after a user clicks a form submit button that posts to the same page.

Thanks very much!

Here is the code that I have came up with so far and it does not work.

<script>

void processForm()
{
document.getElementById(“loadingImg”).style.visibility = “visible”;

// document.getElementById(“form1”).submit();

}

</script>

Here is the line of code with the hidden DIV.

<DIV style=“visibility:hidden;” />
Form Submitted!
</DIV>

Than here is the sample form.

<form action=“” method=“post” enctype=“multipart/form-data” name=“form1” id=“form1” >

<cfinput type=“submit” value=“Upload” onClick=“processForm();” / >

</form>

When the form is posted back to the same page, the old version of the page is destroyed and a new version of the page is then created and shown to the user.

One possible option is to place a querystring value in the action part of the form, so that the new page can check for that querystring value, and if it’s there, the page can then show the submitted message.


<form action="?submitted">

Script at end of body, just before the </body> tag.


if (location.search === '?submitted') {
    document.getElementById("loadingImg").style.visibility = "visible";
}

Thanks for replying to my question. I managed to resolve my issue and you helped to point me in the correct direction. :slight_smile: