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
Solved

Run Code on same form from Button Click

Posted on 1998-09-11
9
218 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wrapper for APPs 9 84
manage footer size 4 72
business account would work but I have a regular paypal account 2 99
Forms that calculate points for wordpress 10 50
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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