473,657 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Client-Side scripting

I have a vb routine below where I'm trying to capture a name from a
javascript prompt box. My application is inline VB on Visual Studio 2003.

The prompt box does display, but when I type a string and hit OK or Cancel,
the value 'ret' which I want to hold the value of the string, is always
empty. And the status bar always says "Done but with errors on page."

If I use a simpler control like alert or confirm, I get no problems.

Can someone point out my error, either conceptual, syntactical, or whatever?

Thanks,

Dave
Sub GetUsername()
Dim ret as String 'This is the value I want to capture
Dim msg As String = "Type your name"
Dim sKey As String = "sKey"
Dim alertScript As String = "<script language=JavaSc ript runat=server>
'" & ret & "' = prompt('" & msg & "'); <" & "/script>"

RegisterClientS criptBlock(sKey , alertScript)
End Sub

Nov 21 '05 #1
5 1163
Dave,

You write in your JavaScript "Runat Server" what will not work with an
alert.

As well has the alert no messagebox part, it is only an "Alert".

Standard is for what you want to use a loginform or otherwise a normal
textbox.

I thought that I had seen that using VBScript somebody could use a kind of
DHTML "messagebox ". However I don't remember me anymore where, maybe you can
look for yourself on Google or MSDE for this. I am myself not interested in
that and keep it to the more standard way of doing this.

However maybe somebody knows that DHTML "messagebox " method.

I hope this gives any ideas anyhow.

Cor
Nov 21 '05 #2
First of all, thanks for your response, Cor.

I have been wrestling with this for a while, looking at some interesting
posts via Google, and I have succeeded in getting the desired value into a
javascript variable thus:

In the html:
<input type="hidden" name="HiddenUse rName" id="HiddenUserN ame" />

In the vb routine
Sub GetUsername()
Dim ret as String 'This is the value I want to capture
Dim msg As String = "Type your name"
Dim sKey As String = "sKey"
Dim alertScript As String = "<script language=JavaSc ript> var ret,
HiddenUID; ret = prompt('" & msg & "'); var HiddenUID =
document.getEle mentbyId('Hidde nUserName'); HiddenUID = ret; <" & "/script>"

RegisterClientS criptBlock(sKey , alertScript)
End Sub

The value for ret is trapped in the RegisterClientS criptBlock call, but I
don't know how to get it into the vb side (server-side). I get an error
saying 'document.getEl ementbyId is not a supported.

Can anyone tell me how to pass the value for ret from the client to the
server? I would need a pretty explicit answer.

Thanks,

David

"Dave" <da************ *************** **@stic.net> wrote in message
news:ul******** ******@tk2msftn gp13.phx.gbl...
I have a vb routine below where I'm trying to capture a name from a
javascript prompt box. My application is inline VB on Visual Studio 2003.

The prompt box does display, but when I type a string and hit OK or Cancel, the value 'ret' which I want to hold the value of the string, is always
empty. And the status bar always says "Done but with errors on page."

If I use a simpler control like alert or confirm, I get no problems.

Can someone point out my error, either conceptual, syntactical, or whatever?
Thanks,

Dave
Sub GetUsername()
Dim ret as String 'This is the value I want to capture
Dim msg As String = "Type your name"
Dim sKey As String = "sKey"
Dim alertScript As String = "<script language=JavaSc ript runat=server>
'" & ret & "' = prompt('" & msg & "'); <" & "/script>"

RegisterClientS criptBlock(sKey , alertScript)
End Sub

Nov 21 '05 #3
Dave,

As I wrote had seen this as well, however did not know anymore where.

As far as I remember me, (it is a while ago I did that) is a simple way to
transport data from client to serverer is using a hidden textbox where you
place (using JavaScript) the information in.

Maybe I try your messagebox, however don't promish that

I hope this helps anyway.

Cor
Nov 21 '05 #4
Dave,

I think that in this way it can work, however there should be better
methods.

\\\ a textbox and a button on a form
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim str As String
If Not IsPostBack Then
TextBox1.ForeCo lor = Color.White
TextBox1.Border Style = BorderStyle.Non e
Dim alertScript As String = _
"<script language=JavaSc ript>document.a ll.item('TextBo x1').value
" & _
" = prompt('Give me text','My name is nobody'); </script>"
RegisterStartup Script("Startup ", alertScript)
Else
str = TextBox1.Text
End If
End Sub
///
I hope this helps a little bit?

Cor
Nov 21 '05 #5
Cor, thanks very much. I need to buff this up a little, but I think it
will work. That document.all.it em was they key for me.

David
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:OL******** ******@TK2MSFTN GP10.phx.gbl...
Dave,

I think that in this way it can work, however there should be better
methods.

\\\ a textbox and a button on a form
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim str As String
If Not IsPostBack Then
TextBox1.ForeCo lor = Color.White
TextBox1.Border Style = BorderStyle.Non e
Dim alertScript As String = _
"<script language=JavaSc ript>document.a ll.item('TextBo x1').value " & _
" = prompt('Give me text','My name is nobody'); </script>"
RegisterStartup Script("Startup ", alertScript)
Else
str = TextBox1.Text
End If
End Sub
///
I hope this helps a little bit?

Cor

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5942
by: Frank | last post by:
Hi, is there a way to use XSL to compare two XML files to verify if a "record" in an XML file has changed of parent in another XML file ? I am trying to implement a template in an XSL stylesheet that would be able to compare the two files below and indicate if a client has changed of category (ex.: from "corp" to "prvt"). Any help would be gladly appreciated, I am desparatly trying to find a
6
4106
by: roger beniot | last post by:
I have a program that launches multiple threads with a ThreadStart method like the following (using System.Net.Sockets.Socket for UDP packet transfers to a server): ThreadStart pseudo code: Connect Receive response Send Connect ACK
2
13001
by: Kumar | last post by:
Hi, I am trying to develop FTP client application using c#. Our application functinality should be like this: 1.our client uploads files,folders to our ftp server for every 20 minutes. 2.At the end of operation they will put one confirmation file (say Done.txt) to conirm their upload operation is completed in that cycle.
0
3931
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
0
1103
by: Glich via DotNetMonster.com | last post by:
#using <mscorlib.dll> #using <System.dll> #include "stdlib.h" #include "stdio.h" using namespace System; using namespace System::Text; using namespace System::IO; using namespace System::Net;
3
5080
by: Michael Hoehne | last post by:
Hi, I'm currently facing a problem with a mixed environment using .NET 1.1 and ..NET 2.0 web services. We have a client application (the "client", system 1) running on .NET 2.0/WinXP, calling our web service (The "Web Service Server") running on a separate machine (also .NET 2.0, Win2003 Server, system 2). The web service server (system 2) itself makes calls to methods in the CRM
0
10704
by: mahesh anasuri | last post by:
Hi all, I am new to this mailing list. Thankful if any one is using curl/linux version to and worked on Https. I have created certificates (PEM format) for client and server using openSSL. I am using Apache server/Linux platform and started server with "server certificate". I configured server to listen HTTPS service at port 443. I downloaded download.txt correctly from server using command as $curl --cacert cacert.pem ...
2
11506
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: CAST(O.MYDATE AS CHAR(30)) When directly updating date fields in the main table, the logged value gets saved in the format YYYY-MM-DD as expected.
14
7745
by: ml_sauls | last post by:
I've built a system to enter and manage purchase orders. This is in use by >10 clients. Some use it in Access 97, most are in A2k. About half use it through a Citrix implementation. It is separated into a front end and 3 back ends (1 network for permanent storage, 1 local for temp storage, and 1 local for storage for particular user). One particular form is failing for a single client (Access 2000, using Citrix). This form is a form...
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.