using vbscript in an asp file 
Author Message
 using vbscript in an asp file

I am sort of new to using VBScript client side scripting.

I have an asp file in which I have a form. In the form there is a text box
and a submit button. WHen I input the value in the text box and hit the
submit button - I want to be able to display the contents of the text box
via a msgbox on to the screen. I already have the code in place but as long
as I do response.write the code works fine. If I do a msgbox the code
doesnot work. The logic is below

<form method="post" action="post to self" onSubmit="return ValidateDate():">
<table border="0" align="left" cellspacing="0" cellpadding="0">
<tr>
<td width="35%"><b>Enter Date (MM/DD/CCYY):</b></td>
<td width="25%"><input type="text" name="txtDate" size="20"></td>
<td width="40%">
<input type="button" value="Get Julian Date" name="btnJDate">
</td>
</tr>
</table>
</form>
<!-- #include file="getJDate.vbs" -->

 In this vbs file, I have
sub btnJDate_Click()
DIM getDate,X
MM/DD/CCYY","Julian Date",Y,5000)
if request.form("txtDate") <> "" then
getDate = request.form("txtDate")
X = ToJulian(getDate)
strMessage = "the date is " & x
'Response.write "<B>The input date is " & "<font color='red'>" &
request.form("txtDate") & "</font></b> "
'Response.write "<B>The date is " & "<font color='red'>" & X & "</font></b>"
msgbox(strMessage) ----- this is how I want to display but this doesnot work
else
getDate = ""
end if
end sub

Can anyone tell me how I can get the msgbox to work without using
Javascripts.

Thanks



Mon, 19 Jul 2004 21:04:51 GMT  
 using vbscript in an asp file
are you trying to get the date to pop up in a message box before the page
actually submits or after it calls itself and loads again??

Quote:
> I am sort of new to using vbscript client side scripting.

> I have an asp file in which I have a form. In the form there is a text box
> and a submit button. WHen I input the value in the text box and hit the
> submit button - I want to be able to display the contents of the text box
> via a msgbox on to the screen. I already have the code in place but as
long
> as I do response.write the code works fine. If I do a msgbox the code
> doesnot work. The logic is below

> <form method="post" action="post to self" onSubmit="return
ValidateDate():">
> <table border="0" align="left" cellspacing="0" cellpadding="0">
> <tr>
> <td width="35%"><b>Enter Date (MM/DD/CCYY):</b></td>
> <td width="25%"><input type="text" name="txtDate" size="20"></td>
> <td width="40%">
> <input type="button" value="Get Julian Date" name="btnJDate">
> </td>
> </tr>
> </table>
> </form>
> <!-- #include file="getJDate.vbs" -->

>  In this vbs file, I have
> sub btnJDate_Click()
> DIM getDate,X
> MM/DD/CCYY","Julian Date",Y,5000)
> if request.form("txtDate") <> "" then
> getDate = request.form("txtDate")
> X = ToJulian(getDate)
> strMessage = "the date is " & x
> 'Response.write "<B>The input date is " & "<font color='red'>" &
> request.form("txtDate") & "</font></b> "
> 'Response.write "<B>The date is " & "<font color='red'>" & X &
"</font></b>"
> msgbox(strMessage) ----- this is how I want to display but this doesnot
work
> else
> getDate = ""
> end if
> end sub

> Can anyone tell me how I can get the msgbox to work without using
> Javascripts.

> Thanks



Tue, 20 Jul 2004 01:41:35 GMT  
 using vbscript in an asp file
Hello Rahul,

I took some of the code you provided and included it in this example.  This
example is pretty straight forward and simple but you can see how easily
you can expand on it.

===============

<form id="frmTest" name="frmTest" method="post" action=""
onSubmit="returnValidateDate()">
 <table border="0" align="left" cellspacing="0" cellpadding="0">
 <tr>
 <td width="35%"><b>Enter Date (MM/DD/CCYY):</b></td>
 <td width="25%"><input type="text" name="txtDate" size="20"></td>
 <td width="40%">
 <input type="button" value="Get Julian Date" name="btnJDate">
 </td>
 </tr>
 </table>
</form>

<script language=vbscript>
sub btnJDate_OnClick
        dim getDate
        dim X

        getDate = frmTest.txtDate.value

        'You can do some formatting here if you'd like.
        'For example I have a COM object that contains a
        'format function like the one VB includes
        strMessage = SampleFormattingFunction(getDate)

        msgbox strMessage

end sub

function SampleFormattingFunction(strParam1)

        SampleFormattingFunction = " * " & strParam1 & " * "

end function
</script>

===============

I hope this helps you.  If you have anymore questions just reply to this
posting.  I'll be checking periodically to see if you had anymore questions
related to this posting.


--------------------

| Subject: using vbscript in an asp file
| Date: Thu, 31 Jan 2002 08:04:51 -0500
| Lines: 46
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

| Newsgroups: microsoft.public.scripting.vbscript
| NNTP-Posting-Host: port147.net109.bignet.net 206.67.109.147
| Path: cpmsftngxa07!tkmsftngxs02!tkmsftngxs01!tkmsftngp01!tkmsftngp07
| Xref: cpmsftngxa07 microsoft.public.scripting.vbscript:90911
| X-Tomcat-NG: microsoft.public.scripting.vbscript
|
| I am sort of new to using vbscript client side scripting.
|
| I have an asp file in which I have a form. In the form there is a text box
| and a submit button. WHen I input the value in the text box and hit the
| submit button - I want to be able to display the contents of the text box
| via a msgbox on to the screen. I already have the code in place but as
long
| as I do response.write the code works fine. If I do a msgbox the code
| doesnot work. The logic is below
|
| <form method="post" action="post to self" onSubmit="return
ValidateDate():">
| <table border="0" align="left" cellspacing="0" cellpadding="0">
| <tr>
| <td width="35%"><b>Enter Date (MM/DD/CCYY):</b></td>
| <td width="25%"><input type="text" name="txtDate" size="20"></td>
| <td width="40%">
| <input type="button" value="Get Julian Date" name="btnJDate">
| </td>
| </tr>
| </table>
| </form>
| <!-- #include file="getJDate.vbs" -->
|
|  In this vbs file, I have
| sub btnJDate_Click()
| DIM getDate,X
| MM/DD/CCYY","Julian Date",Y,5000)
| if request.form("txtDate") <> "" then
| getDate = request.form("txtDate")
| X = ToJulian(getDate)
| strMessage = "the date is " & x
| 'Response.write "<B>The input date is " & "<font color='red'>" &
| request.form("txtDate") & "</font></b> "
| 'Response.write "<B>The date is " & "<font color='red'>" & X &
"</font></b>"
| msgbox(strMessage) ----- this is how I want to display but this doesnot
work
| else
| getDate = ""
| end if
| end sub
|
| Can anyone tell me how I can get the msgbox to work without using
| Javascripts.
|
|
| Thanks
|
|
|



Tue, 20 Jul 2004 06:14:27 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Weird problem with files deltion using wininet HTTP and ASP vbscript

2. Using WSC files from ASP (VBScript)

3. Using WSC files from ASP (VBScript)

4. Executing files using ASP/VBScript

5. ASP ot VBScript / VBScript to ASP

6. Client/server DB using Access-ASP-VBScript

7. Creating pdf from word using asp (vbscript)

8. For...Next loop in ASP using VBScript

9. vbscript from asp using iis on win2k platform with no success

10. Modem and Serial communications using VBScript/ASP/VC++

11. Using a vbscript to shutdown/start a service through ASP

12. Trouble with custom attributes in LDAP using vbscript/ASP

 

 
Powered by phpBB® Forum Software