Solved

HTML form forces users to download the response.

Posted on 2003-11-12
14
311 Views
Last Modified: 2010-04-09
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?
0
Comment
Question by:GreatGatsby
  • 6
  • 3
  • 2
  • +3
14 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 9733741
If you change content.html to content.asp, what happens?
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9733758
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
 

Author Comment

by:GreatGatsby
ID: 9733991
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 31

Expert Comment

by:seanpowell
ID: 9734013
>>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
 

Author Comment

by:GreatGatsby
ID: 9734042
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
 
LVL 33

Expert Comment

by:knightEknight
ID: 9734076
longshot ... your form is named "command" and one of your inputs is also named "command"
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9734084
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
 
LVL 31

Expert Comment

by:seanpowell
ID: 9734089
The input appears to be cmd - not command...
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9734092
Oh, I see what you mean...
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9737790
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
 
LVL 5

Expert Comment

by:prohacx
ID: 9738560
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
 
LVL 3

Assisted Solution

by:Neil Thompson
Neil Thompson earned 250 total points
ID: 9742469
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
 
LVL 11

Accepted Solution

by:
Zontar earned 250 total points
ID: 9742815
> 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
 

Author Comment

by:GreatGatsby
ID: 9752205
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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question