Link to home
Start Free TrialLog in
Avatar of mystami
mystami

asked on

Setting form's action...

Using a vbscript function how do you set a form's action?  I've tried form.action = "goto.htm".  Unfortunately this is not what is to be done.  Please help.
Avatar of DirkVe
DirkVe

In fact, that's the way to do so. Make sure that the name of the form is correct.

If you provide some of your code we can have a look to find possible errors.
hi
try this

response.write("<form> method='post' action='abc.asp'name='abcd'>")

if iam not clear please ellaborate this question

regards
santhosh
Avatar of mystami

ASKER

form1.action = "rg1.asp"
form1.submit

now it submits the form although it just refreshes the page
hi
try this

response.write("<form> method='post' action='abc.asp'name='abcd'>")

if iam not clear please ellaborate this question

regards
santhosh
Avatar of mystami

ASKER

that's not what i'm looking for santho... dirkve seems to be on the right track
hi mystami

iam sorry for the repeat i refreshed the page.
see if you are using an html page in the action please remove method=post from the list
response.write("<form name='abc' action='san.htm'>")
if you want ac asp page use
response.write("<form name='abc' method='post' action='san.htm'>")

hope iam clear

regards
santhosh
Avatar of mystami

ASKER

i understand how to do that santhosh but that's still not what i'm looking for.  if you read i said in vbscript how to set a form's action.
ASKER CERTIFIED SOLUTION
Avatar of mattyk
mattyk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here's a short example:

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<SCRIPT language="VBScript">
function doSubmit()
     form1.action = "rg1.asp"
     form1.method = "post"     ' OR form1.method = "get"
     form1.submit
end function
</SCRIPT>
<FORM name="form1">
<BUTTON onClick=doSubmit()>Submit</BUTTON>
</FORM>
</BODY>
</HTML>


What's important is:
-define the form in your html page with the same name
-the submit IS case secsitive and must be written exaclty how I did
-you can use POST or GET (or leave it empty): POST will send data that's between the FORM-tags (the INPUT fields) in a hidden way; GET will send it in the URL.
-action = name of the page where you want to go to !

I think this should solve your problem, otherwise tell the exact error/problem you have.
hi

<script language="vbscript">
function san1()
san.action="trial.asp"
msgbox san.action
san.submit

end function
</script>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<form name="san" action="" method="post">
<INPUT type="button" value="Button" id=button1 name=button1 onclick="san1">
</form>
<P>&nbsp;</P>

</BODY>
</HTML>


hope iam clear this time

The answer is so simple .

<form name="loveneesh" method="post" action="tt.asp">

</form>

you can try this

but if you really want it through a function then you can use a simple variable and store the file name in this  variable tryhen write action=variable name.


bye loveneesh

if you still need any help then mail me at loveneesh_bansal@hotmail.com
Same remark here for loveneesh_bansal:

Post you answers as COMMENT and not as ANSWER.