-
MagicCell Lookup
I am doing a display lookup on a field that is also a javascript link. In the NameID field I am doing a DisplayLookUp to change the ID to the Actual name. But in a MagicCell I want a popup window to display info about the person. In the link I have
page.asp?Name=#NameID#.
When I do the displaylookup it puts the fullname in the link which I can't have. If I use MagicLookup=false in the options then the DisplayLookUp breaks.
What can I do?
-
can you use NWIND to illustrate the problem ?
Also, specify classic or Tornado.
FK
-
MagicCell Lookup
I am using the Clasic version. The following is an example:
<html>
<head>
<title>NWind Example</title>
<script LANGUAGE="JavaScript">
var wincfg=null;
function popup(linkpage,w,h) {
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;
wincfg=window.open(linkpage, 'Popup', 'toolbars=0, location=0, statusbars=0, menubars=0,scrollbars=1, resizable=1, width='+w+', height='+h+', left = '+LeftPosition+', top = '+TopPosition+'');
}
</SCRIPT>
</head>
<body>
<%
Set X=Server.CreateObject("ASP.DB")
X.dbUserLocalText = zHead & ",<Center></Center>;"
X.dbUnit=189
X.dbMode = "Grid"
X.dbMDB = "D:\database\nwind.mdb"
X.dbSQL = "Select * From [Order Details]"
X.dbMagicCell = "(;~[]#|!) ProductID~~<A HREF=javascript:popup('product.asp?ProdID=#Product ID#',500,450)>#ProductID#</A>"
X.dbDisplayLookupList = "(;|)ProductID||Select ProductID, ProductName from Products"
X.dbGridTableTag = "Border=1"
X.dbGridColSort = false
X.dbColor = "White,Black,White,black,E9EAEC,white,False,False, Red"
X.dbNavigation = "bottom"
X.dbNavigationIcon = "Std"
X.dbNavigationItem = "update,add,delete,download"
X.dbImageDir = "/images/aspdb/"
X.dbButtonAnchor = False
X.ASPdb
%>
</body>
</html>
-
Hi,
First of all, you have "java script" when you should have "javascript"
Next, to solve your problem, the secret is to select a "duplicate" ProductID field AS ProductID2 and then HIDE that field, but use it in your magiccell.
You do the lookup on the "normal" ProductID field and the duplicate ProductID2 field just contains the numeric ID value that you need for your magiccell. Here's the 3 lines of code you need to change in your example to make it work:
X.dbSQL = "Select OrderID,ProductID,ProductID as ProductID2,UnitPrice,Quantity,Discount From [Order Details]"
X.dbGridHideFlds = "ProductID2"
X.dbMagicCell = "(;~[]#|!) ProductID~~<A HREF=javascript:popup('product.asp?ProdID=#Product ID2#',500,450)>#ProductID#</A>"
See how the Select adds the second ProductID2 field? It's then used in the magiccell so that the numeric ID is what's passed to the popup function instead of the "looked up" name.
Take care,
John
Last edited by John; 03-04-2004 at 11:26 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|