Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question HTML, Maybe Javascript -- opening pop up

Status
Not open for further replies.

markronz

IS-IT--Management
Mar 20, 2007
93
US
Sorry, I am pretty new to this sort of thing. I am making a web page which basically queries a database, and displays the information in a table format, based on the search options the user specifies at the top of the screen. This part is actually all done and is working fine. However, one of the columns in my table that I display, may need more explanation. This webpage basically displays a log of emails that were sent out. The column that may need more explanation is the "alert targets" which would detail who was sent the email. All the information displayed on the page, so far, is contained in one database. Unfortunately, this "alert targets" column will have some home grown names in there, such as "Accounting Group" instead of the actual alerting targets (email addresses) contained within that group. This group name to alerting targets relationship information is stored in an entirely different database. Hopefully that all made sense to far.

So what I am trying to do is to make it so that the "Alerting Targets" column in my table is a hyperlink. I would like that hyperlink to open a separate page. This new page will show the details of the contents of the alerting group. But I can't seem to figure out how to pass data to the pop-up window. So on my main page, the cells for the Alerting Target in the table get added like so:

HTML:
output.Append("       <td class='cell'><A HREF = 'popupbasic.html' onClick='return popup(this, 'notes') target='_blank''>" & strTargets & "</A></td>" & vbNewLine)

Then I have the following built into my .aspx script to actually open the pop-up window:

JavaScript:
   <SCRIPT TYPE="text/javascript">
<!--
    Function popup(ByVal mylink, ByVal windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
            Else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//-->
</SCRIPT>

Then to my project (in Visual Studio), I've added a blank file named popupbasic.html.

Can anyone help me figure out how to pass data from my main webpage to this popup window? So that I can then, on the new pop up, have the code look in the other database and display the targets?

Please let me know if that did not make sense or if you need any more information!
 
You can't put a lot of data in a popup. Are you trying to show a whole new page?
Did you get it to show the "Notes" text?
Are you against using a second datagrid to show the details for the particular row that is chosen?

You've got questions and source code. We want both!
Here at tek tips, we provide a hand up, not a hand out.
 
The basic approach would be to append the row ID to the href of the link so you can pick it up in your other page and use it to again query the database for a specific row to get the data you need.

Code:
<td class='cell'><A HREF = 'popupbasic.html[red]?valueName = value[/red]' onClick='return popup(...

The valueName variable should then appear in the GET variables of your chosen server side language with the value you give it.

You could have your server side script a specific value for each row.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thanks for the responses. I am using HTML and Javascript. I'm unfamiliar with what you mean by the GET variables though, could you elaborate some more? I have changed my row lines so they generate as follows now:

HTML:
output.Append("       <td class='cell'><A HREF = 'popupbasic.html?valueName = '" & strTargets & "' onClick='return popup(this, 'notes') target='_blank''>" & strTargets & "</A></td>" & vbNewLine)

But I'm not sure how to GET that variable on the popup like you're mentioning.
 
Since you mention Visual Studio, i'll assume you are using ASP. I'm not too familiar with it, but I believe ASP uses the request.querystring object to get the data from the... well query string. Otherwise known as GET variables for certain other languages.












----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top