Forum Moderators: open

Message Too Old, No Replies

Searching a DB with forms

         

Chart

2:44 pm on Feb 6, 2004 (gmt 0)

10+ Year Member



Hi!

I have a DB that i wish to search by name, date, Organization, etc. Most things are functionning just fine except for the organization search.

What i want to do is have a textbox where i can enter multiple organizations. So on the side of the textbox i would have a link (select for exemple) that would pop up a new, smaller, browser window where i would have a listing of all organizations or whatever. You click one of the choices, your choice gets added to the textbox and the selection window closes.

What i need to know is how to open a new window like this (and control the height and width of it), close it automatically when choosing an option, amd adding this option to the textbox.

txbakers

2:46 pm on Feb 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Chart, welcome to webmaster world.

This is a complicated little bit of code that I solved a few years back. It might be too big to post it here though. I might be able to post a link so you can download it from somewhere. Let me see if I can find it.

works great, people like it.

Chart

3:27 pm on Feb 6, 2004 (gmt 0)

10+ Year Member



Wow i would really appreciate this!

Thx for the help!

Chart

3:03 pm on Feb 11, 2004 (gmt 0)

10+ Year Member



Hey again!

I've worked on this and here's what i got so far :

<script language="JavaScript">
function choisir(source, output)
{
newwin = window.open('','','top=150,left=150,width=565,height=450, toolbar=no, menu=no');
if (!newwin.opener)
{
newwin.opener = self;
}
with (newwin.document)
{
open();

write('<html>');
write('<body>');

write('<p><a href="javascript:window.location.reload()" onclick="<%Session("letter")="A"%>">A</a> ¦ ');
...
write('<a href="javascript:window.location.reload()" onclick="<%Session("letter")="Z"%>">Z</a></p>');

write('<p><%Session("Connection2_ConnectionString") = "DBQ=d:\inetpub\wwwrootmtqaccp\bd\projets\GPRWeb.mdb;DefaultDir=D:\inetpub\wwwrootmtqaccp\bd\projets;Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;;User Id=admin;"%>');
write('<%Set Connection2 = Server.CreateObject("ADODB.Connection")%>');
write('<%Connection2.Open Session("Connection2_ConnectionString")%>');
write('<%if len(Session("letter"))= 0 then%>');
write('<%lettre = "A"%>');
write('<%else%>');
write('<%lettre = Session("letter")%>');
write('<%end if%>');

if (source == "Org")
{
write('<%set rst = connection2.Execute ("SELECT * FROM ORGANISM WHERE NOM_ORGAN LIKE '" & lettre & "%' ORDER BY ORGANISM.NOM_ORGAN")%>');
write('<%while not rst.eof%>');
//Ligne problématique
write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="baseline" width="42"><img src="../../../../img/n1/smenu_boulet.gif" width="7" height="9" hspace="16"></td><td valign="top" width="100%">')
write('<%Response.Write("<a href=""description.asp?NO_PROJ=" & rst("NO_ORGAN") & """>" & rst("NOM_ORGAN") & "</a>")%>')
write('</td></tr></table>');
write('<%rst.movenext%>');
write('<%wend%>');
write('<%Connection2.close%>');
write('<%Set Connection2=Nothing%>');
}

My problem here is that the script gets executed when the page is loaded, so my session variable 'letter' is set to Z whenever i open the window. And the other letters don't change that variable. However, the location.reload seems to work.

So does anyone know why this script gets completely executed at start, or is there a way to prevent this?

Thx in advance

Chart out.