Solved

Run Code on same form from Button Click

Posted on 1998-09-11
9
213 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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
 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

813 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

18 Experts available now in Live!

Get 1:1 Help Now