|
| |
|
|
walrus
Posts: 554 Joined: 3/13/2003 From: London Status: offline
|
response.write asp - 4/27/2003 5:43:50
Here is what Im trying to do If statement to response.write " Email" if the field <%=FP_FieldVal(fp_rs," Email" )%> contains an address. Blank otherwise. Heres the tricky bit. This is then a mailto: link. I just cant get the syntax right. Can anyone help? This is what I have so far <%
if FP_FieldVal(fp_rs," Email" ) = " " then
response.write " "
else
response.write <a href=" mailto:FP_FieldVal(fp_rs," Email" )" >Email</a>
end if
%> Syntax error
< Message edited by walrus -- 4/27/2003 6:29 AM >
_____________________________
I hope The Boss isn't reading this, ...she thinks I program everything!
|
|
|
|
walrus
Posts: 554 Joined: 3/13/2003 From: London Status: offline
|
RE: response.write asp - 4/27/2003 8:56:00
The mailto: link works well. Only problem is that " Email" is displayed even where the field is empty. Makes me wonder whether if FP_Field(fp_rs," Email" ) = " " then
response.write " " is correct. Seems to be. Any better suggestions anyone? Thanks
_____________________________
I hope The Boss isn't reading this, ...she thinks I program everything!
|
|
|
|
Spooky
Posts: 26617 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: response.write asp - 4/27/2003 10:46:58
It depends whats in the database, perhaps there are spaces? if Trim(FP_Field(fp_rs," Email" )) = " " then
response.write " " To do quotes in asp, you have to be careful to include the right amount. Consider this : response.write " Bob said " Hello" You have 3 quotes. 1 Represents the opening of a string. The 2nd, part of the string is a quote, but still part of the string. However, vb interprets it as the close of a sting (matched pair) and would generate an error. " Expected end of statement " Now consider this : response.write " Bob said " " Hello" " With 2 quotes, vb now interprets this as a single quote. However, as there are a total of 5 quotes, an error " Unterminated string constant " will be generated as the string is not closed. This would be a valid string : response.write " Bob said " " Hello" " " Add some html : response.write " Bob said <font size=" " 10" " face=" " verdana" " >" " Hello" " " Add a variable: response.write " Bob said <font size=" " " &Fontsize&" " " face=" " verdana" " >" " Hello" " "
_____________________________
If you arent part of the solution, then there is good money to be made prolonging the problem §þ k¥
|
|
|
|
walrus
Posts: 554 Joined: 3/13/2003 From: London Status: offline
|
RE: response.write asp - 4/27/2003 11:07:44
Ahhaaa!!! Trim Thanks for explaining the quotes Soresponse.write " Bob said " Hello" " doesn' t work then
_____________________________
I hope The Boss isn't reading this, ...she thinks I program everything!
|
|
|
|
Spooky
Posts: 26617 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: response.write asp - 4/27/2003 11:54:48
You are using if FP_Field(fp_rs," Email" ) and not if FP_FieldVal(fp_rs," Email" ) ?
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|