 |

phendyr
User
Jun 16, 2008, 7:51 AM
Post #1 of 2
(581 views)
Shortcut
|
|
question about hiding field that are empty....
|
Can't Post
|
|
I recently found this javascript while searching on ways to hide empty fields: <script type="text/javascript"> if ('$lfieldX$') { document.write("Fax:"); } </script> I was hoping someone could answer this question - I have a text field setup to enter a URL in the hompeage editor. I then use this code on the page to display the link: <a target="_blank" href="$hfield8$">view my website</a> Is it possible to wrap that javascript around this href tag so that if there is no URL entered, it does not display this field? Thanks in advance.
|
|
|  |
 |

MikeB
Staff
/ Moderator

Jun 16, 2008, 1:47 PM
Post #2 of 2
(548 views)
Shortcut
|
|
Re: [phendyr] question about hiding field that are empty....
[In reply to]
|
Can't Post
|
|
Hi phendyr, Thanks for posting! You could definitely set this up and to do this you'd just use some JavaScript that looks like this:
<script type="text/javascript"> if ('$hfield8$') { document.write('<a target="_blank" href="$hfield8$">view my website</a>'); } </script> With this code, if hfield8 has a value then the "view my website" link will be displayed on the site. If this field is left blank no link will be displayed. I hope this helps! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
|