Making the action atribute of the FORM tag dynamic

J

Jerry Manner

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
 
J

JDS

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...
 
J

Jonathan N. Little

JDS wrote:
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.
 
D

diablo

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
 
J

Jonathan N. Little

diablo said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top