-
dynamically change an HTML FORMs "action=" property
Hi,
I'm trying to dynamically change the URL in the "action=" property on a single
HTML FORM. I have 1 form with 3 option buttons (which may become 1 drop down
box). The form needs to be submitted to a different URL depending on which
option the user chooses. My DHTML book say it can be done, but doesn't show
how. Any suggestions? Thanks in advance.
-
Re: dynamically change an HTML FORMs "action=" property
Create client side script (javascript) to do this. An example would be as
follows:
----------------------------------------------------------------------------
------
function GetAction () {
document.frmFile.Action = document.all.cboValues.text
}
function Submit () {
document.frmFile.submit();
}
----------------------------------------------------------------------------
------------
The name of the form you would create in your HTML tag <form> would be
"frmFile" in this example.
ex. <form Method=Post Target=Some_frame id=frmFile Name=frmFile>
Likewise, the name of the cbobox where you're action values reside would be
"cboValues" in this example.
So all you'd have to do would be to set the action value upon click event or
there about.
ex. <SELECT id=cboDocType name=cboDocType onclick=GetAction(); >
The click event may, or may not be, the desire event you want, but it'll get
you there.
When ready to submit, you can do that via javascript as well (ie Submit
shown above).
Good luck
Michael
russ tomendal wrote in message <38d3b00a@news.devx.com>...
>
>Hi,
>
>I'm trying to dynamically change the URL in the "action=" property on a
single
>HTML FORM. I have 1 form with 3 option buttons (which may become 1 drop
down
>box). The form needs to be submitted to a different URL depending on which
>option the user chooses. My DHTML book say it can be done, but doesn't show
>how. Any suggestions? Thanks in advance.
-
Re: dynamically change an HTML FORMs "action=" property
Thanks very much. That's what I needed.
"Michael D" <mdurkin@intertech.com> wrote:
>Create client side script (javascript) to do this. An example would be
as
>follows:
>----------------------------------------------------------------------------
>------
> function GetAction () {
>
> document.frmFile.Action = document.all.cboValues.text
>
> }
>
>
>
> function Submit () {
>
> document.frmFile.submit();
>
> }
>
>----------------------------------------------------------------------------
>------------
>
>The name of the form you would create in your HTML tag <form> would be
>"frmFile" in this example.
>
> ex. <form Method=Post Target=Some_frame id=frmFile Name=frmFile>
>
>Likewise, the name of the cbobox where you're action values reside would
be
>"cboValues" in this example.
>
>So all you'd have to do would be to set the action value upon click event
or
>there about.
>
> ex. <SELECT id=cboDocType name=cboDocType onclick=GetAction();
>
>
>The click event may, or may not be, the desire event you want, but it'll
get
>you there.
>
>
>When ready to submit, you can do that via javascript as well (ie Submit
>shown above).
>
>
>Good luck
>
>Michael
>
>
>
>
>
>russ tomendal wrote in message <38d3b00a@news.devx.com>...
>>
>>Hi,
>>
>>I'm trying to dynamically change the URL in the "action=" property on a
>single
>>HTML FORM. I have 1 form with 3 option buttons (which may become 1 drop
>down
>>box). The form needs to be submitted to a different URL depending on which
>>option the user chooses. My DHTML book say it can be done, but doesn't
show
>>how. Any suggestions? Thanks in advance.
>
>
-
Re: dynamically change an HTML FORMs "action=" property
Hi,
That's very simple.
Just use the following script
document.form.action="URLNAME";
Do it in appropriate event.
Regards
"russ tomendal" <rusjenandall@netzero.net> wrote:
>
>Hi,
>
>I'm trying to dynamically change the URL in the "action=" property on a
single
>HTML FORM. I have 1 form with 3 option buttons (which may become 1 drop
down
>box). The form needs to be submitted to a different URL depending on which
>option the user chooses. My DHTML book say it can be done, but doesn't show
>how. Any suggestions? Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|