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?
 
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.
0
 
seanpowellCommented:
If you change content.html to content.asp, what happens?
0
 
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'>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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.
0
 
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?
0
 
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?
0
 
knightEknightCommented:
longshot ... your form is named "command" and one of your inputs is also named "command"
0
 
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...
0
 
seanpowellCommented:
The input appears to be cmd - not command...
0
 
seanpowellCommented:
Oh, I see what you mean...
0
 
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.
0
 
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!
0
 
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
0
 
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!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.