473,842 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting value of a var from javascript back to ASP

Hi,

I have this function:

<script type="text/javascript">
function disp_prompt() {
var reqid=prompt("P lease enter the membership ID number","")
if (reqid!=null && reqid!="") {
reqid=reqid
}
}
</script>

That produces a prompt to prompt for a number, how can i return the
value (reqid) back to ASP so i can then use it within ASP for database
querys? This has to be very simple and just a pop-up box to ask for the
number and return it back for processing.

Ive tried this with no success.

<%
%snip%
response.write "<script>javasc ript:disp_promp t()</script>"
TidF=reqid
TidFi=INT(TidF)
%snip%

strSQL = "SELECT [FIRST NAME] AS fn, SURNAME AS sn, PHOTO AS
ph, [ID] AS idn FROM MEMBERS WHERE [ID] = "&TidFi&" "

%snip%

%>

Any light on this would be great thanks!

Luke.
Oct 18 '06 #1
2 1333
Hi,

Luke - ea********@gmai l.com wrote:
Hi,

I have this function:

<script type="text/javascript">
function disp_prompt() {
var reqid=prompt("P lease enter the membership ID number","")
if (reqid!=null && reqid!="") {
reqid=reqid
}
}
</script>

Before you try any more, you need to seriously work on understanding the
web paradigm, especially the request/response model. As your example
shows, you think that the server code and the client code are executed
simultanously. However, this is not the case. The server produces
client-side code (typically HTML, JavaScript and CSS), then sends it to
the client. From this moment on, the server doesn't work anymore until
the next request arrives.

The code sent to the client is parsed and interpreted, and JavaScript
code, if available, is executed. If you want to communicate the result
of a JavaScript action to the server, you need to send a new request to
the server, with the information. You have different ways to do that,
for example by POSTing a request and saving the information in a hidden
field (or a text field). Another way is to use GET, i.e. to set the
window.location object with a parameter (query string).

I think that you need to understand all this first, and then do a few
small tests to see how that works.

Good luck,
Laurent
That produces a prompt to prompt for a number, how can i return the
value (reqid) back to ASP so i can then use it within ASP for database
querys? This has to be very simple and just a pop-up box to ask for the
number and return it back for processing.

Ive tried this with no success.

<%
%snip%
response.write "<script>javasc ript:disp_promp t()</script>"
TidF=reqid
TidFi=INT(TidF)
%snip%

strSQL = "SELECT [FIRST NAME] AS fn, SURNAME AS sn, PHOTO AS ph,
[ID] AS idn FROM MEMBERS WHERE [ID] = "&TidFi&" "

%snip%

%>

Any light on this would be great thanks!

Luke.

--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Oct 18 '06 #2
<ea********@gma il.comwrote in message
news:M7******** *************** *******@eclipse .net.uk...
That produces a prompt to prompt for a number, how can i return the value
(reqid) back to ASP so i can then use it within ASP for database querys?
This newsgroup is for issues related to ASP.NET.

For ASP questions, please post on: microsoft.publi c.inetserver.as p.general
Oct 18 '06 #3

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

Similar topics

3
7988
by: dan glenn | last post by:
hi. I want to code a 'preview' function into a guestbook entry page. I can do it with a button that posts, bringing up a whole new page showing a preview of what has been entered, and then the user could hit a 'return to entry form' button or some-such and go back to the form. But what I want to do instead is just use an HTML link with some javascript to grab the form's textarea value, and open another browser window that uses a php file...
2
6931
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on a type mismatch. It is positively because of the boolean(java primitive)parameter. It goes fine if I change this parameter to int or String. This inteface has a lot more methods which works fine, it is just the
1
3455
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with ***********************, I've included all the code incase that isn't where the problem is. Any help would be hugely appreciated. Mick
21
4013
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does nothing in IE. I'd be greatful for any assistance. Also, if I will have problems the code on Opera or Safari, I'd appreciate any pointers--I don't have a Mac to test Safari. THanks very much, Michael
9
2747
by: ShaneFowlkes | last post by:
Hey guys... I have a form that asks for several dates. I tried using asp calendar controls to set values of the date textboxes which were readonly. I found this annoying since each time I advanced a month and/or selected any date, it posted back and refreshed the page. So, instead, I resorted to an old javascript function I use a lot. The javascript creates a pop up (html) window and sets the value of the textbox when the user picks a...
10
2447
by: eggie5 | last post by:
Is it possible to get a file without using a form post? I want to get the data (bytes) of a file, text or binary, and just save it to a variable. Similar to the post body of a form that has a file input element in it. Ultimately what I want to do is get a file off client machine (that they specify) and send it to the server using a standard post request. This is exactly the same as a form post with an file input element, but I don't...
4
2184
by: My Pet Programmer | last post by:
Ok guys, I'm really looking for someone to tell me how bad a hack this is, and if I'm close to where I should be with it. The basic situation is that I have a class which creates a basic calendar control, the only difference is I stole the navigation scheme from Vista (e.g., if you click on the year you zoom out to the months list, then out to the decade, and back in when you click a year, then a month). I ran into some trouble...
4
2399
omerbutt
by: omerbutt | last post by:
hi there i am making an application in which i have a drop down menu which onchange passes a value(this.value) to a js function which gets the value and calls an ajax routine and passes that value to a php page and then takes back the response ,i have done it all but now i was trying to encrypt the information or the string or the value that is passed through the drop down menu and concatinated with the url and passed to that page and then on...
7
4449
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am surrendered to you. <%@ Language=VBScript%> <%Option Explicit%>
0
10952
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10618
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10683
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
10320
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
7862
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
7045
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
5887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4506
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
3
3148
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.