Making the action atribute of the FORM tag dynamic

Discussion in 'HTML' started by Jerry Manner, Jun 22, 2005.

  1. Jerry Manner

    Jerry Manner Guest

    Hi

    Is it possible to make the action part of the form tag more flexible?
    instead of a constant address ( as below)?

    <FORM action="ResultTable.htm" method="get">
    <p align="left">
    <input type="text" name="T1" size="50"><br>
    <input type="image" src="ELPic/Logo.gif" alt="submit" width="89"
    height="23">
    </FORM>

    I need this so that under a certain condition, while clicking the logo,
    the action is done to another address.
    Can the action attribute look like this ' <FORM action=X method="get">'
    and that the X variable is set somewhere else?

    Regards
    Jerry Manner, Jun 22, 2005
    #1
    1. Advertising

  2. Jerry Manner

    JDS Guest

    On Wed, 22 Jun 2005 01:22:32 -0700, Jerry Manner wrote:

    > Hi
    >
    > Is it possible to make the action part of the form tag more flexible?
    > instead of a constant address ( as below)?
    >
    > <FORM action="ResultTable.htm" method="get">
    > <p align="left">
    > <input type="text" name="T1" size="50"><br> <input type="image"
    > src="ELPic/Logo.gif" alt="submit" width="89"
    > height="23">
    > </FORM>
    >
    > I need this so that under a certain condition, while clicking the logo,
    > the action is done to another address. Can the action attribute look like
    > this ' <FORM action=X method="get">' and that the X variable is set
    > somewhere else?
    >
    > Regards


    Isn't it funny how very similar questions often seem to get asked in
    groups? (See slightly earlier thread posted by "diablo")

    In any case...

    The answer to your question is "yes, but..."

    yes, but you will have to use some sort of server-side scripting to do it.
    ASP, PHP, ColdFusion, or similar. I am fairly certain that there is no
    client-side solution for this problem.

    later...

    --
    JDS |
    | http://www.newtnotes.com
    DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
    JDS, Jun 22, 2005
    #2
    1. Advertising

  3. JDS wrote:
    <snip code>
    >>
    >>I need this so that under a certain condition, while clicking the logo,
    >>the action is done to another address. Can the action attribute look like
    >>this ' <FORM action=X method="get">' and that the X variable is set
    >>somewhere else?
    >>
    >>Regards

    >
    >
    > Isn't it funny how very similar questions often seem to get asked in
    > groups? (See slightly earlier thread posted by "diablo")
    >
    > In any case...
    >
    > The answer to your question is "yes, but..."
    >
    > yes, but you will have to use some sort of server-side scripting to do it.
    > ASP, PHP, ColdFusion, or similar. I am fairly certain that there is no
    > client-side solution for this problem.
    >
    > later...
    >

    Yes, you can trap and change the form's action on submit with
    JavaScript, BUT if the client has JavaScript disabled (an ever
    increasing situation) this will fail. Server-side is only way to be
    certain of success.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jun 22, 2005
    #3
  4. Jerry Manner

    diablo Guest

    Hi

    yes and if your using IIS then you may have issues doing it server side as
    well. in particular if you do sometig like this

    if request.form("submit")="Logo Press" then response.redirect logo_press.asp
    else response.redirect some_place_else.asp


    then the form post data is not passed on to the redirected page. i found
    some stuff to do with 307's...but it all adds to a pain in the ...

    D
    ps - i guess you could recreate and pop your form on the imbetween page


    "Jonathan N. Little" <> wrote in message
    news:bRfue.872$...
    > JDS wrote:
    > <snip code>
    > >>
    > >>I need this so that under a certain condition, while clicking the logo,
    > >>the action is done to another address. Can the action attribute look

    like
    > >>this ' <FORM action=X method="get">' and that the X variable is set
    > >>somewhere else?
    > >>
    > >>Regards

    > >
    > >
    > > Isn't it funny how very similar questions often seem to get asked in
    > > groups? (See slightly earlier thread posted by "diablo")
    > >
    > > In any case...
    > >
    > > The answer to your question is "yes, but..."
    > >
    > > yes, but you will have to use some sort of server-side scripting to do

    it.
    > > ASP, PHP, ColdFusion, or similar. I am fairly certain that there is no
    > > client-side solution for this problem.
    > >
    > > later...
    > >

    > Yes, you can trap and change the form's action on submit with
    > JavaScript, BUT if the client has JavaScript disabled (an ever
    > increasing situation) this will fail. Server-side is only way to be
    > certain of success.
    >
    > --
    > Take care,
    >
    > Jonathan
    > -------------------
    > LITTLE WORKS STUDIO
    > http://www.LittleWorksStudio.com
    diablo, Jun 25, 2005
    #4
  5. diablo wrote:
    > Hi
    >
    > yes and if your using IIS then you may have issues doing it server side as
    > well. in particular if you do sometig like this
    >
    > if request.form("submit")="Logo Press" then response.redirect logo_press.asp
    > else response.redirect some_place_else.asp
    >
    >
    > then the form post data is not passed on to the redirected page. i found
    > some stuff to do with 307's...but it all adds to a pain in the ...
    >
    > D
    > ps - i guess you could recreate and pop your form on the imbetween page
    >
    >

    <snip>

    I avoid IIS as much as possible, ;-) but I would suggest then to make
    one common receiving script and fork depending on parameters. If there
    is overlap, this method might be more efficient than two scripts.

    Else on a redirect the receiving script would have to build a query
    string to parse the form field values.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jun 25, 2005
    #5
    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. Joe Bloggs
    Replies:
    1
    Views:
    726
    Sudsy
    Aug 3, 2003
  2. shruds
    Replies:
    1
    Views:
    757
    John C. Bollinger
    Jan 27, 2006
  3. ocelka
    Replies:
    2
    Views:
    394
    Romin
    Mar 18, 2005
  4. gtb

    Atribute error

    gtb, Apr 26, 2007, in forum: Python
    Replies:
    2
    Views:
    240
  5. Bart

    property atribute does not work

    Bart, Dec 15, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    110
Loading...

Share This Page