|
-
Jun 11th, 2001, 05:34 AM
#1
Thread Starter
Hyperactive Member
VBScript (Easy one)
He everyone,
I want to make my form pass the data into a string when the button is clicked... But it ain't working...
Code:
<HTML>
<HEAD>
<TITLE>Test formulier</TITLE>
<SCRIPT language="VBScript ">
function cmdToHosting_OnClick()
Dim strOrganisatie
strOrganisatie = Document.persgegevens.organisatie.Value
MsgBox ("Data =" & StrOrganistatie)
End Sub
</SCRIPT>
</HEAD>
<BODY>
<FORM method=GET name="pergegevens" border="1">
<TR>
<TD>
Naam organisatie
</TD>
<TD>
<INPUT name="organisatie" size="30">
</TD>
</TR><TR>
<TD>
Naam contactpersoon
</TD>
<TD>
<INPUT name="contactpersoon" size="30">
</TD>
</TR><TR>
<TD>
<INPUT type="button" name="cmdToHosting" value="Hosting toevoegen">
</TD>
</TR>
</FORM>
</BODY>
</HMTL>
Plz look for errors, cause I'm pretty new to VBScript it probably is a newbie error
Grtz,
Bloged
P.S. Can you pass data between two forms located on other pages wich are loaded after eachother
-
Jun 11th, 2001, 06:03 AM
#2
You can use this.
Code:
<INPUT type="button" name="cmdToHosting" value="Hosting toevoegen" onclick="cmdToHosting_OnClick()
">
-
Jun 11th, 2001, 11:56 AM
#3
Frenzied Member
Your inputs have no type attribute. You should add type=Text to your input tags.
Get out of the habit of using Msgbox on a web page. Use window.alert instead. If you use Msgbox in server side code, you will do one of two things: Cause an error, or stop the application with a modal dialog box on the server.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jun 11th, 2001, 01:24 PM
#4
Thread Starter
Hyperactive Member
The first thing: I already tried that... so that wasn't a succes!
The second thing: Tnxs I'm used to program in Visual Basic..
Grtz,
Bloged
-
Jun 11th, 2001, 02:15 PM
#5
Addicted Member
<SCRIPT language="VBScript ">
Sub cmdToHosting_OnClick()
Dim strOrganisatie
strOrganisatie = Document.persgegevens.organisatie.Value
MsgBox ("Data =" & StrOrganistatie)
End Sub
</SCRIPT>
-
Jun 11th, 2001, 02:22 PM
#6
Black Cat
Cause an error, or stop the application with a modal dialog box on the server.
If would have to be an error, because if you made a dialog box, it would be near impossible to click it.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 11th, 2001, 04:45 PM
#7
Frenzied Member
If you have debugging turned on in IIS, it will pop up the dialog box and the app will stop until it is clicked. Otherwise, it will simply not do anything. Point is, don't use MsgBox on web pages.. there are better alternatives.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jun 12th, 2001, 01:58 AM
#8
Thread Starter
Hyperactive Member
Ok I've changed the Function in a Sub and replaced MsgBox with Window.Alert
Now it comes with a Runtime error
Line 30
cmdToHosting_OnClick is not defined
I hope I translated the error OK cause my browser is in Dutch
Grtz,
Bloged
P.S. Is VBScript Case-Sensitive
-
Jun 12th, 2001, 06:25 AM
#9
Black Cat
If you have debugging turned on in IIS, it will pop up the dialog box and the app will stop until it is clicked.
Where would the dialog box pop-up? I wouldn't think it would have a screen to paint itself on.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 12th, 2001, 06:42 AM
#10
Thread Starter
Hyperactive Member
He JoshT
Where would the dialog box pop-up? I wouldn't think it would have a screen to paint itself on.
What do you mean with this???
Grtz,
Bloged
-
Jun 12th, 2001, 08:44 AM
#11
Addicted Member
Make sure your control has the same name as in your script .
As for case sensivity, No, VBScript isn't case sensitive !
Good luck
-
Jun 12th, 2001, 08:47 AM
#12
Addicted Member
Oops, I forgot you posted the whole code and the names matches Sorry, i dunno what's the problem then with the names...!
-
Jun 12th, 2001, 08:50 AM
#13
Thread Starter
Hyperactive Member
Ok I've done that already!
So what can it be...
Plz post some code how you would do this... Get the value of a INPUT field and load it into a string....
Grtz,
Bloged
-
Jun 12th, 2001, 11:41 AM
#14
Frenzied Member
Bloged: Repost your modified version of the code.
Josh: If you have IIS debugging enabled, a msgbox will popup on the server if you use it in server side script. That is the only way it will do it. When debugging is not enabled, the ASP processor ignores Msgbox.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jun 12th, 2001, 04:11 PM
#15
Hyperactive Member
you spelled </html> wrong, you did </hmtl>
-
Jun 13th, 2001, 06:20 AM
#16
Black Cat
monte96: This is what's throwing me off: Since the web server generally runs with the anonymous user account, wouldn't the Msgbox have to go to the anonymous user's screen, which doesn't exist? Or does it get displayed to whoever is locally logged on's screen ("interact with desktop" rights), and if the server would be sitting there at the log-on screen, it would pop up there?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 13th, 2001, 10:35 AM
#17
I suggest you try doing it in jScript.
cos it will be browser neutral
-abhijit
-
Jun 13th, 2001, 10:50 AM
#18
Hi there,
I would like to present a solution.
here is your code re-written.
One thing, in your code you have opened a function but closed it with an End Sub. I wonder why?
<HTML>
<HEAD>
<META name=VI60_defaultClientScript content=VBScript>
<TITLE>Test formulier</TITLE>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub cmdToHosting_onclick
Dim strOrganisatie
Dim strcontactpersoon
strOrganisatie = pergegevens.organisatie.value
strcontactpersoon = pergegevens.organisatie.value
MsgBox ("Data =" & strOrganisatie & " " & strcontactpersoon)
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<FORM name="pergegevens" method="get">
<TABLE border="1">
<TR>
<TD>
Naam organisatie
</TD>
<TD>
<INPUT name="organisatie" size="30">
</TD>
</TR><TR>
<TD>
Naam contactpersoon
</TD>
<TD>
<INPUT name="contactpersoon" size="30">
</TD>
</TR><TR>
<TD>
<INPUT
type="button"
name="cmdToHosting"
value="Hosting toevoegen">
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
-
Jun 13th, 2001, 11:54 AM
#19
Frenzied Member
JoshT: I think the assumption here is that you wouldn't turn on IIS debugging on a production server that was inaccessable. You would be logged on to do the debugging. But, yes, it would get displayed to the current logged in interactive account.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Jun 15th, 2001, 04:12 AM
#20
Thread Starter
Hyperactive Member
The Code above repeats the First string...
When I want to use another JavaScript too I probaply have to rewrite my code don't I or is there a way you can combine them...
Grtz,
Bloged
-
Jun 15th, 2001, 04:56 AM
#21
Addicted Member
Re: VBScript (Easy one)
Hi there,
Just observe ur code
function cmdToHosting_OnClick() ----Function starts here.
Dim strOrganisatie
strOrganisatie = Document.persgegevens.organisatie.Value
MsgBox ("Data =" & StrOrganistatie)
End Sub --- Ended with a procedure ? it should start as a
proc. right?
Last edited by Venkrishna; Jun 15th, 2001 at 05:10 AM.
there r no alternatives 4 hardwork.
-
Jun 15th, 2001, 05:11 AM
#22
Thread Starter
Hyperactive Member
End Sub --- Ended with a procedure ? it should be End function right?
I'm a intermediate VBProgrammer and I just started vbScript so: I don't understand you're question, or I'm doing something totally wrong (probably both)...
Grtz,
Bloged
-
Jun 15th, 2001, 05:14 AM
#23
Addicted Member
Hi blogged,
may be i have confused u
replace ur code with the procedure as below.
Sub cmdToHosting_onclick()
' ur code
End sub.
Hope I am clear now.
there r no alternatives 4 hardwork.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|