Author |
Topic  |
dava133
Starting Member
United Kingdom
9 Posts |
Posted - 26 February 2002 : 18:13:19
|
I need to disply a field from a database as a hyperlink. The field is fldEmail and i would like the link to be mailto:<fldEmail>. It is displayed as a label at the moment.
I was thinking something like this would work:
fldEmail="<a href="mailto:fldEmail">fldEmail</a>
but it doesnt, can someone point me in the right direction to correct this, cheers
David
|
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 19:01:32
|
quote:
I need to disply a field from a database as a hyperlink. The field is fldEmail and i would like the link to be mailto:<fldEmail>. It is displayed as a label at the moment.
I was thinking something like this would work:
fldEmail="<a href="mailto:fldEmail">fldEmail</a>
but it doesnt, can someone point me in the right direction to correct this, cheers
David
You can use something like this, admiting that rs("YourField") has the value you want:
strField = "<a href=""mailto:" & rs("YourField") & """>" & rs("YourField") & "</a>"
|
 |
|
dava133
Starting Member
United Kingdom
9 Posts |
Posted - 26 February 2002 : 20:18:26
|
Right just tried that and didnt work, I am a complete newbie to ASP and I am using a program called code charge so trying to add this code in the beforeshow section, can you explain the rs and the str at the beginning? cheers
David |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 20:38:21
|
quote:
Right just tried that and didnt work, I am a complete newbie to ASP and I am using a program called code charge so trying to add this code in the beforeshow section, can you explain the rs and the str at the beginning? cheers
David
If you are reading the field from a database you are using a recordset object to "store" the values read from the database, aren't you?. I'm supposing that rs is the recordset object variable where you keep the records read from the database.
Also strField is just a variable where you store the HTML before outputing it using Response.Write, as in
<%Response.Write strField %>
Have I made myself clear this time?
|
 |
|
dava133
Starting Member
United Kingdom
9 Posts |
Posted - 26 February 2002 : 21:24:56
|
Im sure u were clear the first time im just not very good at this yet so didnt understand well, and Im still not sure but ill have a play and see what happens! The text the the program generates seems to be a bit different to what your saying and I think thats why Im getting confused! cheers
David |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 21:31:34
|
quote:
Im sure u were clear the first time im just not very good at this yet so didnt understand well, and Im still not sure but ill have a play and see what happens! The text the the program generates seems to be a bit different to what your saying and I think thats why Im getting confused! cheers
David
David do you have the code reading the value from the database? Do you want to show it here (only if it's not too many lines, otherwise write as a txt file and provide a link to it, please)? That way I can see how we can change it to do what you want...
|
 |
|
dava133
Starting Member
United Kingdom
9 Posts |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 21:52:03
|
Sorry David, it's not enough for me to understand what's going on.
Can you please do something similiar with the other 2 ASP files: common.asp, header.asp.
A question: you are relying entirely on this automatically generaded code, right?
Edited by - ruirib on 26 February 2002 21:53:00 |
 |
|
dava133
Starting Member
United Kingdom
9 Posts |
Posted - 26 February 2002 : 21:56:03
|
Yeah I am, this bit of code im looking to add now, is like extra. Ive done the same with the other 2 files Header.txt and Common.txt, but dont think header is relevant as its only a navigation bar really, if u can run it locally ill send u the whole site if that will help, cheers
David
Edited by - dava133 on 26 February 2002 21:56:47 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 21:59:43
|
Emailing me the site would be good, but I would need the database also. Is that a test database?
|
 |
|
dava133
Starting Member
United Kingdom
9 Posts |
Posted - 26 February 2002 : 22:04:10
|
yeah it is so that doesnt bother me, where u want me to send it m8?
David |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 22:04:29
|
David,
replace line 287 in your UserRecord.asp by this one:
SetVar "Email", "<a href=""mailto:" & fldEmail & """>" & fldEmail & "</a>"
Then try it to see if it works...
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 22:06:33
|
Try my previous recomendation. If it doesn't work send everything to ruirib@computer.org.
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 22:12:14
|
quote:
Lol can u give me a hint where that line is! I dont have any fancy text editors and counting that many lines might take me a while!!
David
It's in the bottom 20 lines. You'll find several lines beginning with SetVar...
|
 |
|
dava133
Starting Member
United Kingdom
9 Posts |
Posted - 26 February 2002 : 22:13:17
|
Worked a treat m8 thanks a lot!! lol onto my next problem..!!
David |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 February 2002 : 22:16:39
|
quote:
Worked a treat m8 thanks a lot!! lol onto my next problem..!!
David
You're welcome. I'm glad I could help
But you are in for a major fun. Trying to figure out some auto generated code with a simple tool like a text editor that will not even let you find in which line number you're in...
Enjoy it  .
|
 |
|
Topic  |
|