Solved

Run Code on same form from Button Click

Posted on 1998-09-11
9
204 Views
Last Modified: 2013-12-25
Can I run code on the same form from a button click?
I know how to goto another form and pick up variables, run code etc, but cannot see how to do it on the same form.
I am using FP98 for the HTML and VB Script and IEXP 3.02.
Thanks.
0
Comment
Question by:rogerb082098
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 4

Expert Comment

by:raoool
ID: 1854958
You can use GET method and some Javascript to pass forms data at the browser. Good starting point at...

www.hotwired.com/webmonkey/javascript/code_library/parse_get/?TW=javascript&category=forms_data
0
 
LVL 28

Expert Comment

by:sybe
ID: 1854959
Do you mean something like this ?

<script>
function SomeFunction() {
  document.myForm.myTextfield.value="button clicked";
}
</script>

<form name="myForm">
<input type="text" name="myTextfield">
<input type="button" name="mybutton" value="Click Here" onClick="SomeFunction()">
</form>

0
 

Author Comment

by:rogerb082098
ID: 1854960
Java Script no good, I need to be able to do this with VB Script.
0
 

Expert Comment

by:shez
ID: 1854961
you can submit the form to itself:
<form action="sameform.XXX">
or you can add an onclick event to the button:
<input type="button" name="button" value="runit" onClick="name of your sub()">
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:rogerb082098
ID: 1854962
Shez

Thanks for the answer but this is a form that has already posted data to itself in the way your describe. What I now require is to be able to run Server Side code dependant on which Button is clicked on the Client - which I think is a little more complicated.

Roger

0
 

Accepted Solution

by:
shez earned 80 total points
ID: 1854963
you must give all buttons the same name and diffrent values:
<input type="submit" name="btn1" value="value1">
<input type="submit" name="btn1" value="value2">
and then write ASP VBscript somthing like this:
<%
select case btn1
   case "value1"
      script
   case "value2"
      script
end select
%>
0
 
LVL 28

Expert Comment

by:sybe
ID: 1854964
This is the same, but now in VBScript

<script>
Function SomeFunction()
  document.myForm.myTextfield.value="button clicked";
End Function
</script>

<form name="myForm">
<input type="text" name="myTextfield">
<input type="button" name="mybutton" value="Click Here" onClick="SomeFunction()">
</form>
0
 

Expert Comment

by:shez
ID: 1854965
you must give all buttons the same name and diffrent values:
<input type="submit" name="btn1" value="value1">
<input type="submit" name="btn1" value="value2">
and then write ASP VBscript somthing like this:
<%
btn1 = Request("btn1")    
select case btn1
    case "value1"
       script
    case "value2"
       script
end select
%>
p.s. you got to add this request line to asp code.
0
 

Author Comment

by:rogerb082098
ID: 1854966
That'll do.


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Read about why website design really matters in today's demanding market.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now