If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Populate field 2 (run Query) based on input in field 1

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-04, 05:05
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
Populate field 2 (run Query) based on input in field 1

Hi there !!

I got a table (Postinfotable) which looks like this :

Postnr | Poststed
-------------------
0010 Oslo
0456 Oslo
2800 Gjovik
2850 Raufoss
-------------------

In my ASP page, i want to make the user to input (text field) a "Postnr" and when user exits/refresh/onBlur (or anything) the field, it should run a sql query against the Postinfotable with "Postnr" to lookup the correct "Poststed" for that "Postnr" and insert that into the "Postnummer" form-field..

How can this be done ?
If someone has a URL/Webpage/Metods to use i'd be extremely happy.. kinda stuck with this

Best regards
Terje
__________________
Best regards
Mirador
Reply With Quote
  #2 (permalink)  
Old 10-11-04, 19:20
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
sounds kinda like a basic homework/assignment question to me.... you probably want to do a google search on something like "asp database queries"
Reply With Quote
  #3 (permalink)  
Old 10-12-04, 03:42
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
Solution :

Yea.. u prolly right, but i've googled this for quite many hours.. Might be that i lack brain to find correct searchwords though

But.. the good news is that i managed to work it out..

Solution :

using OnChange() event on the "Postnr" field, which triggers a function with an IFRAME (which is _not_ a popup), with "postnr" as parameter.
Using Request.GetParameter("postnr") and put it in a temp variable.
Then i build the SQL query with the temp variable and picks out the Postnr, followed by putting the value into a hidden field on the "IFRAME" form.

End it all with sending the value to the parent form and closing the window..

Voila..
__________________
Best regards
Mirador
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On