Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Sending the user to an asp page from fdf JavaScript

I have a fdf form that uses insert2gateway.asp as a email and database insert portal I have put some error checking in here to make sure everything works this is called by the JavaScript this.submitForm method,
I want to send the user to another page that check session vars I set in the gateway,
I found I can put a goto URL action in the fdf button after the JavaScript but it gets called even if the JavaScript fails.

Is their any way to do this from inside the JavaScript??
0
HamisH
Asked:
HamisH
  • 6
  • 2
1 Solution
 
Karl Heinz KremerCommented:
You have to do this on the server: When the FDF is accepted, the server would then redirect the browser to a new page.
0
 
Karl Heinz KremerCommented:
Just to clarify: Neither the JavaScript submitForm command, nor the Submit action that you can use as a button action does return a status information. So it's not possbile to open a web link only on success. You can do this however on the server: The CGI script that handles your FDF submission can return a something like the following line in the header of the page:

<META HTTP-EQUIV="REFRESH" CONTENT="0; URL=http://www.yoursite.com/newpage/">
0
 
Karl Heinz KremerCommented:
Why did you give a "C" grade? Just because this is not the answer you expected does not mean that the answer is wrong. I'll request a review of the grade.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
HamisHAuthor Commented:
i gave a c becaue both the ansers you gave did not work a reponse.redirect form with in the asp page causes an error and becaus of the way the page is called a mett refresh wont work eather.

cheers }{amis}{
0
 
Karl Heinz KremerCommented:
THen you should not have closed the question and requested more information.
0
 
Karl Heinz KremerCommented:
I just verified that a refresh does work: A PDF document in displayed in the browser. I click on the submit button, and the forms information is sent to the web server. The script that processes the data then sends a page with a refresh header. I'm doing this with a Perl CGI script, but I'm pretty sure that anything that I can do with Perl should also be possible with an ASP page.
The information in the browser changes from the PDF document to a very brief display of the redirect page, followed by the target page.

This is the script I'm using (it does not actually process anything, but this discussion, this is not important):

#!/usr/bin/perl -w
use strict;
  use CGI qw/:standard/;

  my $page= '/index.html';
  print header(-refresh => "0; URL=$page");
  print start_html, p('Please wait...'), end_html;

The actual answer to your question was that the JavaScript submitForm() command cannot be used to redirect to a different page. You can also not detect if a submission was sucessful, so it would not work to just access a web site after you call submitForm(). You would go to this new page after a sucessful, and also after an unsucessful forms submission.

In addition to answering your question, I provided a workaround.
0
 
HamisHAuthor Commented:
sorry my mestake how di i change the grade?

cheers }{amis}{
0
 
Karl Heinz KremerCommented:
You can probably just leave a request here, which will be picked up when the moderator reviews this question., but you can also post a request in the SUpport area (use the link at the top of the page).
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now