maggiemel
Posts: 75
|
| Posted: 01/16/2007, 9:41 AM |
|
Hello, everybody. I use a link from a grid to a details which I modify dynamically based on a user's login priveleges. So, an end-user gets a link like <a href="view_details.asp"> while an administrator gets <a href="edit_details.asp">.
I would like it if the view_details.asp page opened in a pop-up window. My problem is that when I add the javascript onclick event to the HTML, it appears for both the view_details and the edit_details links (as expected). But in the code to modify the link, I don't see how I can add in an "onclick" event. Does anyone have any suggestions?
Many thanks in advance!
_________________
Melissa Cahill
http://www.hellcatmaggie.net/ |
 |
 |
E43509
Posts: 283
|
| Posted: 01/16/2007, 12:45 PM |
|
Perhaps the low risk way to do this is to put two links on your page, one for admins, one for users. Add your JS logic as appropriate and hide or show that link in the before show event based on the security group they belong to.
There may be a more elegant solution, but I've used this to just get it done and simplify my life.
|
 |
 |
maggiemel
Posts: 75
|
| Posted: 01/16/2007, 2:09 PM |
|
Hi, E43509! I actually figured out the elegant -- and stupidly easy -- way to do this. I just added a Label in the HTML view within the <a href> tag, like this:
<a href="{dynLink}" {dynJava} >
Then in the Before Show event, I set the value like this:
form.dynJava.Value = "onclick='OpenPopup(this.href,width=700,height=500);return false;' "
Make sure you set the Content Type of the Label to HTML, otherwise you get the code.
Works great!
_________________
Melissa Cahill
http://www.hellcatmaggie.net/ |
 |
 |
peterr
Posts: 5971
|
| Posted: 01/16/2007, 2:21 PM |
|
That's a nice solution. Thanks for sharing.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
marcwolf
Posts: 361
|
| Posted: 01/16/2007, 6:18 PM |
|
Hi All
You can do a lot with labels that have the HTML property set.
You can insert HTML blocks of text (Very good for Dynamic or CMS style sites) or insert various block of javascript. One f my pages has just 3 labels. Each lable is filled in the before show with HTML text from the database. And this text is generated using a FCKeditor based page
With links I have found that it best to construct the links in their entirity and then put them in as a HTML label. With previous experience that CSS and its HTML interpreter can have problem with links that have been modified.
Take care all
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 01/17/2007, 3:55 AM |
|
Strong tool + strong community = success.
Indeed thanks for sharing.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|