Solved

Setting form's action...

Posted on 2001-07-19
12
286 Views
Last Modified: 2008-03-06
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.
0
Comment
Question by:mystami
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
12 Comments
 
LVL 2

Expert Comment

by:DirkVe
ID: 6297922
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.
0
 

Expert Comment

by:santhoshgivesuanswers
ID: 6297924
hi
try this

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

if iam not clear please ellaborate this question

regards
santhosh
0
 
LVL 1

Author Comment

by:mystami
ID: 6297937
form1.action = "rg1.asp"
form1.submit

now it submits the form although it just refreshes the page
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:santhoshgivesuanswers
ID: 6297950
hi
try this

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

if iam not clear please ellaborate this question

regards
santhosh
0
 
LVL 1

Author Comment

by:mystami
ID: 6297956
that's not what i'm looking for santho... dirkve seems to be on the right track
0
 

Expert Comment

by:santhoshgivesuanswers
ID: 6297966
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
0
 
LVL 1

Author Comment

by:mystami
ID: 6297973
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.
0
 
LVL 5

Accepted Solution

by:
mattyk earned 100 total points
ID: 6298017
See this little code sample:

<script language="VBScript">
function setAction()
     msgbox "Original action=" & Form1.action
     Form1.action="http://www.experts-exchange.com"
     msgbox "New action=" & Form1.action
     
end function

</script>


<form name="Form1" action="">
     <input type=text name=test><br>
     <input type=button value="Click" onclick="setAction">

</form>

-matty
0
 
LVL 2

Expert Comment

by:DirkVe
ID: 6298034
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.
0
 

Expert Comment

by:santhoshgivesuanswers
ID: 6298104
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

0
 
LVL 1

Expert Comment

by:loveneesh_bansal
ID: 6298180
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
0
 
LVL 2

Expert Comment

by:DirkVe
ID: 6298199
Same remark here for loveneesh_bansal:

Post you answers as COMMENT and not as ANSWER.

0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBScript on Html 15 64
send email part1 9 51
Html split(text) Part2 6 38
Getting robots.txt Error 9 54
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question