teufel
|
| Posted: 11/06/2002, 5:12 AM |
|
Hi,
I need to 'disable' some links in a grid depending on the value of the link. That is: some records will have links to its detail page and others not, thus avoiding the user to edit some specific records.
I understand the code for a link is generated on the fly, but the 'href' tag is present inside the HTML template.
Any suggestions of how to do that? Is that even possible?
TIA
|
|
|
 |
RonB
|
| Posted: 11/08/2002, 4:25 AM |
|
Without knowing how the table containing the links is setup this is not easy to answer. There are several ways to do this depending on what you want.
(I'm guessing your link table contains at least 3 fields:
link_id(number) link_name(text) and link_url(the actual link))
a. Links are stored as text not html i.e. as index.php and not as <a href=....
- do a beforeshow event on the label(for this example I'm asuming you use link_text as the label and that label has content set to html)
global $gridname;
if(link_id <> somevalue)
{
$gridname->link_text->setvalue("<a href='"
.$gridname->link_url>Value ."'>" .$gridname->link_text->Value ."</a>");
}
this will get you clickable links when if statement returns true and plain text if it returns false
I'd recommend another setup though:
in your linktable make sure you have the following fileds:
link_id (number)
link_url(<a href=...)
link_active(value 1 is yes 2 is no)
now all you have to do is set the value for active and only those links will show up if you include the link_active part in your where clause (where link_active=1)
I use the above setup for development fase. The intranet only shows links where active is 1, the development fase uses the same database and webserver but I only add the where clause on the new page just before publishing so the link to the new page only shows up on the intranet when the page is done. Until that time the value for active on the new links is 2
|
|
|
 |
|