Change target of form AFTER submit

Discussion in 'ASP .Net' started by David Adams, Jun 6, 2006.

  1. David Adams

    David Adams Guest

    Hi,

    I have an aspx page that has a series of radio buttons that are
    autopostback. When a selection is made, the form posts back and displays
    specific input fields for the radio button selected. After the input fields
    have been filled out, a button is clicked that changes the target of the
    form to "_blank" and posts back - opening a new page where the input fields
    are used to create a pdf document. The problem is getting the target of the
    form back to nothing so that if the user clicks another radio button (or
    something else on the page that posts back) it does not open a new window.
    With javascript, I have tried the following:

    document.forms[0].target='_blank';
    document.getElementById('{0}').click();
    document.forms[0].target='';

    and

    document.forms[0].target='_blank';
    __doPostBack('btnPDF','');
    document.forms[0].target='';

    ....but the JS does not work as intended. I don't want to have to change the
    target of the form back every time I would normally post back - I want to be
    able to change it after the form is submitted. Ideally, I'd like to have a
    "afterSubmit" event for the form!

    Any ideas?

    Thanks,
    Dave
    David Adams, Jun 6, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mohit
    Replies:
    0
    Views:
    544
    mohit
    Jan 23, 2008
  2. Rui Pestana
    Replies:
    7
    Views:
    293
    Rui Pestana
    Nov 24, 2003
  3. Marco Alting
    Replies:
    7
    Views:
    505
    Thomas 'PointedEars' Lahn
    Oct 30, 2003
  4. Replies:
    0
    Views:
    801
  5. Replies:
    3
    Views:
    662
Loading...

Share This Page