 |

irishis
User
Feb 17, 2003, 4:23 PM
Post #1 of 12
(2874 views)
Shortcut
|
|
another question about not showing unused defined fields
|
Can't Post
|
|
I saw the solution about what to do if a field doesn't have anything in it and you don't want it to show up, use a little script. Sorry to sound ignorant here but that script <script language="Javascript"> if ('$art_field#$' != '') { document.write("Field name: " + '$art_field#_he$'); } </script> where exactly do I insert it? in the head? And do I have to put in each field I want that to apply to? Please say no Erin
|
|
|  |
 |

Benjamin
Staff

Feb 17, 2003, 4:57 PM
Post #2 of 12
(2872 views)
Shortcut
|
|
Re: [irishis] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Hey Erin, I'm afraid so... this little script examines only ONE field to see if it's blank, so you'll need to include it for all fields that you think might be occasionally be empty. Concerning the placement of the code, you have to find the location of where the fieldname is being printed to the page, e.g. Field name: $lfield55$ and replace that entire thing with the javascript code. Also, be sure to add the noscript tags, after the closing script tag: <noscript> Field name: $lfield#$ </noscript> This is printed to the screen if the user's browser isn't javascript enabled. Without this, anyone non running javascript wouldn't see anything for that field - even if it has a value! [Oh, and also you'll have to change the art_field to lfield, for Realty Manager instead. :-) ] Ben interactivetools.com
|
|
|  |
 |

irishis
User
Feb 18, 2003, 12:26 PM
Post #3 of 12
(2856 views)
Shortcut
|
|
Re: [Benjamin] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Benjamin, I have no hair left, I've pulled it all out! Ok here is the problem, I'm using the code below to hide fields like you told me: <br> <font face="ms sans serif" size=3><b>$lfield2$ <script language="Javascript"> if ('$lfield3$' != '') { document.write("ARI#: " + '$lfield3_he$'); } </script></b></font><br> Field number 2 is male or female, field number 3 has the title of ARI# and if there is one, obviously there would be one. What I'm getting back is this: ARI#: Female <<that is what is coming out on the page. Here is the url if you want to peek.
|
|
|  |
 | |  |
 |

Benjamin
Staff

Feb 18, 2003, 12:38 PM
Post #5 of 12
(2848 views)
Shortcut
|
|
Re: [irishis] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Hi Erin, Thanks for the link. Well, first of all your code WILL print out the value of $lfield2$ first, so what's it's value in that particular page? I must admit, the javascript looks fine... try playing around with the value of lfield3 for that listing (removing it entirely, changing it's value), and refresh the page each time. Is there any correlation between the output and that field's value? Ben interactivetools.com
|
|
|  |
 |

irishis
User
Feb 19, 2003, 4:54 PM
Post #6 of 12
(2826 views)
Shortcut
|
|
Re: [Benjamin] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Hi Benjamin, for whatever reason the javascript is working great-thank you! Do you know if there is a way to have it fill in or not depending on if it's filled out when the Field Name is one <td>and the fill in is the other <td>? I can't figure out how to get columns to line up unless I have to seperate cells for title and answer. Just asking, not a major thing......unless my client says it is.
|
|
|  |
 |

Benjamin
Staff

Feb 21, 2003, 11:52 PM
Post #7 of 12
(2775 views)
Shortcut
|
|
Re: [irishis] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Sure! You could just change this: if ('$lfield3$' != '') { document.write("ARI#: " + '$lfield3_he$'); } to this: if ('$lfield3$' != '') { document.write("<td>ARI#:</td><td>" + '$lfield3_he$' + </td>); } And that should just about do it... to be honest, it'd rather tricky to know exactly how you want it without looking at your page code. But the above will certainly place the fieldname and field values in two different cells. Hope this helps! :-) Ben interactivetools.com
(This post was edited by Benjamin on Feb 21, 2003, 11:52 PM)
|
|
|  |
 |

irishis
User
Mar 6, 2003, 7:37 AM
Post #8 of 12
(2706 views)
Shortcut
|
|
Re: [Benjamin] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Could you check this one more time for accuracy: if ('$lfield3$' != '') { document.write("<td>ARI#:</td><td>" + '$lfield3_he$' + </td>); } Is that second <td> in the right place? Something isn't right, the field isn't showing up now whether there is something in it or not. I'm going nuts here because it's time to implement all this stuff we've talked about html, hidden blank fields and neither is working! I must be doing something wrong here. Here is the url http://design.criabarn.com/rm/listings/ pick the first one, this one I know has a birth date but the field and date are not there, if you reveal source you will see my coding and it shows up in the coding as having a birthdate and the actual date shows in the source but not on the page itself.
|
|
|  |
 |

irishis
User
Mar 6, 2003, 8:34 AM
Post #9 of 12
(2703 views)
Shortcut
|
|
Re: [irishis] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
Good news I was playing around with the coding because something did seem right with the quotation mark so I changed it to this: <script language="Javascript"> if ('$lfield6$' != '') { document.write("<td>BIRTH DATE:</td><td> + '$lfield6_he$' + </td>"); } </script> I got it to show the fields but still ended up with a problem, here is what is showing up now: BIRTH DATE: + '6/8/01' + So there is a problem with the second <td> any ideas??
|
|
|  |
 |

dlo_itools
Staff

Mar 6, 2003, 10:39 AM
Post #10 of 12
(2691 views)
Shortcut
|
|
Re: [irishis] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
The quotes and the +'s were still mismatched. Try this simpler version: <script language="Javascript"> if ('$lfield6_je$' != '') { document.write('<td>BIRTH DATE:</td><td>$lfield6_je$</td>'); } </script> The quotes have been changed to single-quotes only, and _je added to the fieldname to ensure that any embedded single quotes in the value won't mess up the script. /Dave Lo
|
|
|  |
 |

irishis
User
Mar 6, 2003, 10:45 AM
Post #11 of 12
(2690 views)
Shortcut
|
|
Re: [dlo] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
I just got it to work doing this....I was desperate and trying different things. <script language="Javascript"> if ('$lfield9$' != '') { document.write("<td><strong>DUE DATE:</strong></td><td><strong>$lfield9_he$</strong></td>"); } </script> will it be ok? I does work I've tried it, I removed the "+"'s and '
|
|
|  |
 |

dlo_itools
Staff

Mar 6, 2003, 1:40 PM
Post #12 of 12
(2681 views)
Shortcut
|
|
Re: [irishis] another question about not showing unused defined fields
[In reply to]
|
Can't Post
|
|
That will work too if you're dealing with date data. /Dave Lo
|
|
|  |
|