homepage Welcome to WebmasterWorld Guest from 23.22.173.58
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
How do I have a query lookup in a DB show up in a text box?
I'm not sure how to do this on my webpage
Sid3ways

5+ Year Member



 
Msg#: 3841668 posted 12:52 am on Feb 4, 2009 (gmt 0)

Posted this in the Java/Ajax forum but figured I'm not even sure if that is where it should go. I think here is better so mods if you can delete the other one I'd appreciate it.

Note: I'm using Dreamweaver CS4.

I'm having an issue on my web page trying to figure out how to get this done. I have a repair log web page I created and this is the only part left. We have a text field up top that the operator would input the last 6 digits of a vehicles VIN# and then click the button. It should then lookup in my database the entire 17 digit vin number and put it in the VIN text box. I have a picture I'm including to show you how it is setup and the code behind it.

I'm not sure if I'm on the right track but I've created a recordset in DW and it functions. The recordset goes to my DB table and searches for "ends with" the 6 digits of the vin. When I've got the recordset box open and click the "TEST" button where it has you input a value to see if it work, it works beautifully. In the test return it shows the whole vin number. The problem is, I have no idea what to do at this point.

I don't know how to:
1. Link the recordsets' lookup information to the text box that would contain just the 6 digits.
2. Link the recordset to activate by hitting the "Get Full VIN" button
3. Link the recordset to use the Full VIN text box as where it should output the result.

If anyone can help with this stuff I would GREATLY appreciate it!
Thanks!

[edited by: mack at 8:47 pm (utc) on Feb. 4, 2009]
[edit reason] Removed image link, thanks! [/edit]

 

brotherhood of LAN

WebmasterWorld Administrator brotherhood_of_lan us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 3841668 posted 8:39 am on Feb 5, 2009 (gmt 0)

Just to clarify, are you using ASP/MSQL?

Sid3ways

5+ Year Member



 
Msg#: 3841668 posted 8:43 pm on Feb 5, 2009 (gmt 0)

I am using ASP and MSQL yes. I was playing with the recordset today and searching online I found some more help.

I have created a session variable called vinlook. I have set the first text box linked to this vinlook. I then modified the recordset to look for the session variable vinlook. I'm not sure how to make a button activate this lookup now. When I load the page to view it, it now just automatically posts the first VIN# from the table in the result box without even inputting any value. So apparently the recordset activates when the page loads but the search box is empty so I'm not sure why it is showing the first value in the DB table with a blank entry box. Any suggestions?

[edited by: Sid3ways at 8:46 pm (utc) on Feb. 5, 2009]

mattur

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3841668 posted 3:57 pm on Feb 10, 2009 (gmt 0)

Hi Sid3ways

The thing to get your head around is what happens on the server, and what happens in the browser. An ASP page is executed on the server, then the resulting HTML is sent to the browser. There is no connection from the HTML page to the ASP or recordset on the server, ASP just generates the raw HTML and sends it to the browser.

Once the HTML is sent the recordset no longer exists, and even if it did exist the browser can't connect to it because it's on the server and there's no connection from browser to server. ASP just generates and sends "normal" HTML pages.

So, to populate the full VIN text box with a partial value entered in a HTML form, you must send the partial value to an ASP page on the server, which then queries the database and sends the full VIN in the HTML it returns.

There's two ways of doing this:

1. Easiest way: user enters partial VIN, clicks "Get Full VIN" button that submits to the server ASP, which then looks up the full VIN, and returns the same page but now with the looked up full VIN in the <input value="here">.

You could do this as two pages: first page for just partial VIN input and "Get Full VIN" button, which submits to a second page with the full VIN and all the other inputs.

2. (Much) harder way: Use AJAX to send a query to the server, and Javascript to set the full VIN in the box. This doesn't submit the actual page, but is much more difficult. I'd get the other way working first... HTH

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved