/    Sign up×
Community /Pin to ProfileBookmark

i want to make a pop up menu to display data from database, after that i want to pass the record i selected into a text box…i work jz like a combo box…how to i do it….any recommend page or sample? thanx

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@buntineMay 11.2005 — Why can't you just use a combo box? This will require some pretty extensive DHTML and/or JavaScript programming.
Copy linkTweet thisAlerts:
@fyanymauthorMay 11.2005 — because my field name are very long, if display in the combo box its not such pretty... and i need to add some description in the selection box...

example:

product code description

00000000001 Super Genius 3.564 USB Optical mouse
Copy linkTweet thisAlerts:
@buntineMay 11.2005 — Why not just use a table or something to display the data? Cramping everything into a selection box will probably look bad aswell.
Copy linkTweet thisAlerts:
@fyanymauthorMay 11.2005 — i want to do something like in the yahoo mail addressbook, when i click a link, the addressbook appear, i can select my frend's email there, the email address i was selected will pass to the text box address field...tats my objective...
Copy linkTweet thisAlerts:
@buntineMay 11.2005 — Ok. That must be done with JavaScript as ASP can only execute from the server. I will move this thread to the JavaScript forum for you.

Regards.
Copy linkTweet thisAlerts:
@fyanymauthorMay 11.2005 — anyway...thanx 4 help!
Copy linkTweet thisAlerts:
@fyanymauthorMay 11.2005 — *****I FOUND THE WAY******

<html>

set con=server.CreateObject("ADODB.Connection")

set rs=server.CreateObject("ADODB.Recordset")

con.open "Driver={MySQL ODBC 3.51 Driver};server=localhost;uid=root;database=restaurant"

strSQLPrct="SELECT item1, desp FROM table"

rqKey = request("key")

rqFieldName = Request("field")


<script LANGUAGE="JavaScript">

function ignore(){
return true;
}
function sendback(stockcode){
window.onerror=ignore;
window.opener.<%=rqFieldName%>.value = stockcode;
self.close();
}


</script>



<body>

<form name="f1">

<%

rs.Open strSQLPrct, con

If rs.EOF Then

Response.Write "No record found."

Else

Response.Write "<center><h3>Select from the following item</h3>"

Response.Write "<BR><INPUT TYPE=BUTTON VALUE=""Cancel"" ONCLICK=""window.close();return(false);"" id=BUTTON1 name=BUTTON1>"

Response.Write "<TABLE>"

Do Until rs.EOF

Response.Write "<TR><TD><a href=""javascript:sendback('" & rs("stockcode") & "','" & rs("stockdesp") & "');"">" & _

rs("stockcode") & " " & rs("stockdesp") & "</a></TD></TR>"

rs.MoveNext

Loop

Response.Write "</TABLE>"

End If

rs.Close

Set rs = Nothing

con.Close

Set con = Nothing

Response.Write "<BR><INPUT TYPE=BUTTON VALUE=""Cancel"" ONCLICK=""window.close();return(false);"" name=BUTTON1>"

%>

</center>

</body>

</html>
Copy linkTweet thisAlerts:
@buntineMay 11.2005 — Good job!
×

Success!

Help @fyanym spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...