Submit Form stopped working after enabling SSL
The site I’m working on has an option for a printable version for many of the pages. What we have been doing is using an Include file to creates a form on the page (name=printForm). This form contains a number of hidden fields that are required for the proper generation of the page.
This is an example of the form.
<form name="printForm" action="chart_main.asp?chartname=npl&print=true" method="POST" target="NEW">
<input type="hidden" name="closeme" value="OK">
<input type="hidden" name="print" value="true">
</form>
We are using coolMenus - Version 3.02 – from www.bratta.com to generate dynamic menus. For the location value in this menu we are using 'javascript:submitForm()'. This calls this function.
function submitForm()
{
document.printForm.submit();
}
This worked great before the site started using SSL. Once we enabled SSL on the site we started getting a Page cannot be displayed error when you select the print version. If you place an Alert in the submitForm function, it will appear. So the code is calling the function but it is not submitting the form properly. When you get this error, you end up with an address like this.
https://dev.dc.keylogic.com/javascript:submitForm()
Of course, that address will fail.
Does anyone have an idea why this is not working since SSL has been enabled and how we may get around it?
Re: Submit Form stopped working after enabling SSL
Hi,
SSL encrypts the URL and the data within it from teh controls and code. If you hav code within the URL it is not encoded then decoded as normal, therefore is not recognised as any sort of command or code at all, as the header now includes the reference to the encryption socket, therefore looks for encrypted data and not anything else within the Uniform Locator such as code commands and such.
To get round this, sisply use the Onload function and use your javascript there.
example.
VB Code:
<body OnLoad="document.hello.print()">
This will operate the controls for you.
If you want to use multiple controls depending on the selection, then write a javascript code to read the URL and execute code depending on the outcome.
hope this helps
Kai