Restoring OTHER form field after submit

Discussion in 'Javascript' started by ed_spain, Sep 23, 2005.

  1. ed_spain

    ed_spain Guest

    Hi Everyone,

    On an HTML page with 2x different forms, how can I redisplay the same
    page after a submit, restoring the values from BOTH forms even though
    only one was submitted?

    I have an existing PHP program that I am modifying, and need to
    redisplay the same page after a submit (the button that submits is a
    "change shipping" button, that allows the user to continue with the
    rest of the page). The problem is that there are TWO forms - the one
    that allows you to change shipping, and the other where the user can
    fill in the billing address. Making this into one form is not really an
    option, due to how the program is set up.

    Since they are 2 different forms, submitting the "change shipping" form
    does NOT bring the billing address fields to my PHP code in the POST.
    This makes restore difficult.

    I have a couple of kludgy ideas on how to work around this (mostly
    javascript based - e.g. setting hidden fields in the "change shipping"
    form when the user is changing the billing fields). However, I was
    wondering if there were any other easy solution to acheive this.

    Thanks,
    Ed Eichman
    Spain
     
    ed_spain, Sep 23, 2005
    #1
    1. Advertising

  2. ed_spain

    Evertjan. Guest

    ed_spain wrote on 23 sep 2005 in comp.lang.javascript:

    > On an HTML page with 2x different forms, how can I redisplay the same
    > page after a submit, restoring the values from BOTH forms even though
    > only one was submitted?
    >
    > I have an existing PHP program that I am modifying, and need to
    > redisplay the same page after a submit (the button that submits is a
    > "change shipping" button, that allows the user to continue with the
    > rest of the page). The problem is that there are TWO forms - the one
    > that allows you to change shipping, and the other where the user can
    > fill in the billing address. Making this into one form is not really an
    > option, due to how the program is set up.
    >
    > Since they are 2 different forms, submitting the "change shipping" form
    > does NOT bring the billing address fields to my PHP code in the POST.
    > This makes restore difficult.
    >
    > I have a couple of kludgy ideas on how to work around this (mostly
    > javascript based - e.g. setting hidden fields in the "change shipping"
    > form when the user is changing the billing fields). However, I was
    > wondering if there were any other easy solution to acheive this.


    If you submit to the same page, you can pre-fill both forms as you like.

    However this is serverside php coding in your case, so off topic.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Sep 23, 2005
    #2
    1. Advertising

  3. ed_spain

    ed_spain Guest

    Thanks Evertjan,

    > If you submit to the same page, you can pre-fill both forms as you like.
    >
    > However this is serverside php coding in your case, so off topic.


    In a single form, I know how to use PHP to retreive the user enter
    values and restore them if the same form needs to be displayed again
    (e.g. if they fill in the billing info, and forget to specify their
    city - redisplay the form with the input info and tell them to complete
    the form correctly).

    However, there are TWO forms, and I need to be able to get the values
    which are ONLY in the HTML form which is NOT being submitted - which is
    why I though Javascript might be the solution (using javascript to put
    the form #2 values into a hidden field in form #1 so that my PHP code
    can catch the values and restore them).

    .....or, what I'm really looking for are ideas on how to make the whole
    thing "easy" - trying to see if I've missed something simplier.

    Thanks,
    Ed
     
    ed_spain, Sep 23, 2005
    #3
  4. ed_spain

    Evertjan. Guest

    ed_spain wrote on 23 sep 2005 in comp.lang.javascript:

    > Thanks Evertjan,
    >
    >> If you submit to the same page, you can pre-fill both forms as you like.
    >>
    >> However this is serverside php coding in your case, so off topic.

    >
    > In a single form, I know how to use PHP to retreive the user enter
    > values and restore them if the same form needs to be displayed again
    > (e.g. if they fill in the billing info, and forget to specify their
    > city - redisplay the form with the input info and tell them to complete
    > the form correctly).
    >
    > However, there are TWO forms, and I need to be able to get the values
    > which are ONLY in the HTML form which is NOT being submitted - which is
    > why I though Javascript might be the solution (using javascript to put
    > the form #2 values into a hidden field in form #1 so that my PHP code
    > can catch the values and restore them).


    Nonsense, info in the html must be known to he serverside, otherwise the
    html could not be rendered serverside.

    > ....or, what I'm really looking for are ideas on how to make the whole
    > thing "easy" - trying to see if I've missed something simplier.


    Please reread the thread. And fix this serverside.


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Sep 23, 2005
    #4
    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. viki
    Replies:
    6
    Views:
    611
    Erik Wikström
    Jun 28, 2008
  2. Jarrick Chagma
    Replies:
    28
    Views:
    1,088
    Martin Gregorie
    May 27, 2009
  3. Marcelo Alvim
    Replies:
    1
    Views:
    113
  4. Barry
    Replies:
    1
    Views:
    163
  5. Replies:
    3
    Views:
    751
Loading...

Share This Page