HTML form forces users to download the response.

Here is a weird problem I have been having...

I have a form that posts to an asp page like this:

This form is on the content.html page and posts to the results frame

<form action='http://www.somdomain.com/aspen/page.asp' target='results' method='POST' name='command'>
            cmd<input type='text' name='command'>
            ses<input type='text' name='session_id'>
            ver<input type='text' name='version' value='2.0'>
            <br />
            aic<input type='text' name='aicc_data' size="100">
      </form>

I am using a frame set that is setup like this:

<frameset frameborder="0" border="0" framespacing="0" rows="*,1" onLoad="opener.close();">  
  <frame src="content.html" name="content" frameborder="0">
  <frame src="results.htm" name="results" scrolling="0" frameborder="0">
  <noframes>
   ...
  </noframes>
</frameset>

All the target is doing is preventing my original frame from redirecting to the asp page.  This works fine for some computers but others try to download the response from the asp page as a text file ('page.asp').  Does anyone have any ideas about this problem?
GreatGatsbyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

seanpowellCommented:
If you change content.html to content.asp, what happens?
seanpowellCommented:
Also, I believe the target should be set in the frameset, as opposed to the form tag:

<frame src="content.html" name="content" frameborder="0" target="results">

<form action='http://www.somdomain.com/aspen/page.asp' method='POST' name='command'>
GreatGatsbyAuthor Commented:
By setting the frame target to my other frame It would only replace my content frame with the information I wanted in the results frame.  The whole idea behind the results frame is that I don't want my content frame to be redirected on a post.  I can't use a .asp page for my content frame becuase it cannont be regenerated each time.  It is running a Flash movie that is communicating with the browsers javacript to get information from the page.asp page that the form submits to.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

seanpowellCommented:
>>I don't want my content frame to be redirected on a post.
So what should happen to content.html after hitting the submit button?
GreatGatsbyAuthor Commented:
The content.html frame should remain the same.  I am having to fix someone else's code so the forced download does not occur.  The hard thing about this is that it only happens on some computers  not all.  I have tried looking at the browser settings and everything on the computer and cannot find a good reason for this to be happening.  What would cause a browser to download the response to a form rather than to just post it to the correct frame?
knightEknightCommented:
longshot ... your form is named "command" and one of your inputs is also named "command"
seanpowellCommented:
The only thing I can think of is if the browser's settings are not setup to handle the asp extension - but that would be unlikely...
seanpowellCommented:
The input appears to be cmd - not command...
seanpowellCommented:
Oh, I see what you mean...
ZontarCommented:
The target attribute should be in the form tag and should use the name of one of the frames.

The form has to submit *to* something, and when it does, the user's browser attempts to load the file in the form's action attribute.

> The only thing I can think of is if the browser's settings are not setup to handle the asp extension - but that would be unlikely...

The browser normally acts according to the content-type header that's sent with the content. What's happening is that the form handler page is sending some content-type other than "text/html". When the form submitted, what filetype/extension shows in the browser's "Save As..." dialogue?

A link or some form handler code would be helpful.
prohacxCommented:
Have you tried

<form action='http://www.somdomain.com/aspen/page.asp' target='results' method='POST' name='command' enctype='text/html'>

Also, make sure you do not have a form named "command" and an input field named "command" (simply do not name your form can be a solution too...)

Good luck!
Neil ThompsonSenior Systems DeveloperCommented:
I had this problem a while ago with a wap site

the solution was solved simply by adding <html>  and </html> openers and closers in the page, as I didn't have them before the asp code tried to push a download

worth a look

Neil
ZontarCommented:
> the solution was solved simply by adding <html>  and </html> openers and closers in the page, as I didn't have them before the asp code tried to push a download

This might well explain the problem.

Another solution might be to add

Response.ContentType = "text/html"

to the page before any content is sent to the client.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GreatGatsbyAuthor Commented:
You guys both gave correct answers.  I didn't generate the asp page, so when I was digging through the code I discovered the the ContentType was set to "text/plain" we changed it to "text/html" and no more problems!  Thank you so much!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.