a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

How to Collapse Blank Fields

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> How to Collapse Blank Fields
Page: [1]
 
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
How to Collapse Blank Fields - 3/7/2007 14:51:08   
Does anyone know how to make blank database fields collapse on the search results page so that there is no empty space?

http://www.thca.org/active/assocsearch.asp?service=Other

thanks.
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 15:23:07   
Not sure what you mean and the link provided does not work.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to adh11576)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:03:42   
Sorry about the link. I forgot it's password protected. Let me try to explain.

My DRW displays this info:

Company:
Name:
Address:
Phone:
Website:
Service:

Not all of the clients in my database have a website, so when it displays the results, it looks like this:

Company:
Name:
Address:
Phone:

Service:

If there is no info for that field, I'd like it to not appear, causing the blank space to disappear.

Does that make sense?

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:14:41   
Pretty easily accomplished, but FP may want to undo your changes. Can you post the code for the page in question?



_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to adh11576)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:17:24   
I'm not worried about FP. I can edit the code myself if you have method.

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:21:45   
I'd like to see the code so I can tell you exactly where to edit. Open the page and switch to html view and then copy and paste it here. Also, if you look at the html you will see a bunch of gray code that FP adds. This code will likely undo any edits you perform. However, that can be gotten around by "dieting" the code. The diet process gets rid of the gray code (most of it) and then allows you to edit the asp code (red). Here is a link to a macro that will diet the code for you:

http://www.frontpagewebmaster.com/m-279509/tm.htm

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to adh11576)
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:24:18   
After the diet, its pretty much a case of :

<%
If fp_field(fp_rs,"column") & "" = "" then
' do nothing
else
' write the value
end if
%>


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to BeTheBall)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:26:51   
thanks for the tips. I'll run the dient macro and give it a try.

(in reply to Spooky)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 19:37:51   
Well, I'm not the clever. Here's the field I'm working with:
<%=FP_FieldVal(fp_rs,"Website")%>

Can you tell me how it will would look with this:
<%
If fp_field(fp_rs,"column") & "" = "" then
' do nothing
else
' write the value
end if
%>

thanks.

(in reply to adh11576)
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 20:09:50   
As Duane suggested, the actual code to the page would help so we know if you are using tables, or paragraphs etc, but try something like:

<%IF trim(FP_FieldVal(fp_rs,"Website")&"") > "" THEN%>
<%=FP_FieldVal(fp_rs,"Website")%>
<%END IF%>

You would have to fit that around the html you are using to display the results.




_____________________________

Sally

(in reply to adh11576)
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: How to Collapse Blank Fields - 3/7/2007 22:22:10   
You cant use "val" but this would work

<%If FP_Field(fp_rs,"Website") &""<>""%>
<%=FP_Field(fp_rs,"Website")%>
<%End if%>


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to rubyaim)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 16:15:09   
Here's the code. ALso here's the page to test: http://www.thca.org/assocmembers.asp Click on "Other".

thanks for your time and help.
            <!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Associates WHERE (SERVICE =  '::Service::') ORDER BY Company ASC"
fp_sDefault="Service="
fp_sNoRecords="There are currently no matches in our databse. Please try your search again."
fp_sDataConn="thca"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=10
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="COMPANY"
fp_sMenuValue="COMPANY"
fp_sColTypes="&ID=3&IMAGE=203&COMPANY=202&ADDRESS=202&ADDRESS2=202&CITY=202&STATE=202&ZIP=202&PHONE=202&FAX=202&Website=202&SELLS=202&SERVICE=202&"
fp_iDisplayCols=11
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<div align="center">
            <table border="0" cellpadding="2" cellspacing="1" style="border-collapse: collapse" width="100%">
              <tr>
                <td valign="top" width="34">
                <p align="center">
                <img border="0" src="<%=FP_FieldLink(fp_rs,"IMAGE")%>"></td>
                <td valign="top">
                <p style="margin-bottom: 8px"><font face="Verdana" size="2">
                <font color="#0C3765"><b>
          <%=FP_FieldVal(fp_rs,"COMPANY")%></b></font><br>
          <%=FP_FieldVal(fp_rs,"ADDRESS")%><%=FP_FieldVal(fp_rs,"ADDRESS2")%><br>
          <%=FP_FieldVal(fp_rs,"CITY")%>,
          <%=FP_FieldVal(fp_rs,"STATE")%><font color="#FFFFFF">-</font><%=FP_FieldVal(fp_rs,"ZIP")%><br>
          Phone:
          <%=FP_FieldVal(fp_rs,"PHONE")%><br>
          Fax:
          <%=FP_FieldVal(fp_rs,"FAX")%><br>
          <%IF trim(FP_FieldVal(fp_rs,"Website")&"") > "" THEN%><%=FP_FieldVal(fp_rs,"Website")%><%End if%><br>
          <i><%IF trim(FP_FieldVal(fp_rs,"SELLS")&"") > "" THEN%><%=FP_FieldVal(fp_rs,"SELLS")%><%End if%></i></font></td>
              </tr>
            </table>
          </div>
          <!--#include file="../_fpclass/fpdbrgn2.inc"-->

          <p><br>
          <font face="Verdana" style="font-size: 8pt">
          <img border="0" src="../images/star.gif" width="19" height="19">
          <font color="#7F5700"><b>= Gold Star Club</b></font></font></td>
        </tr>
      </table>


< Message edited by Spooky -- 3/8/2007 17:44:01 >

(in reply to Spooky)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 16:26:44   
Looking at the link, what is the concern? Is it the missing fax numbers you want to do something about?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to adh11576)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 17:13:11   
No, it's the website (right below the fax) and the product description (below website, in <i>)

(in reply to BeTheBall)
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 17:21:40   
You could try something like:

<%If FP_Field(fp_rs,"Website") &""<>"" Then%>
<%=FP_Field(fp_rs,"Website")%><br>
<%End if%>

<%If FP_Field(fp_rs,"SELLS") &""<>"" Then%>
<i><%=FP_Field(fp_rs,"SELLS")%></i>
<%End if%>

</font></td>

This is similar to what you have, except the 'end if' has been moved so it won't line break if the field is empty.

You could also do similar to not show the 'Fax:' if it's empty.



_____________________________

Sally

(in reply to BeTheBall)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 17:26:58   
Thanks. I edited the code per your suggestion and the empty spaces are still there.

(in reply to rubyaim)
rubyaim

 

Posts: 757
Joined: 6/22/2005
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 17:38:05   
Maybe try removing the <br> from the end of the Fax and doing something like:

<%If FP_Field(fp_rs,"Website") &""<>"" Then%>
<br>
<%=FP_Field(fp_rs,"Website")%><br>
<%End if%>

If that's no good, post the changed code..

With this sort of thing you need to include your html in the if then as required.


_____________________________

Sally

(in reply to adh11576)
adh11576

 

Posts: 9
Joined: 3/7/2007
Status: offline

 
RE: How to Collapse Blank Fields - 3/8/2007 17:38:55   
**SOLVED
Actually Sally, I didn't have exactly what you suggested. Once I did, that solved the issue. Thank you VERY much for all of your help.

(in reply to adh11576)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> How to Collapse Blank Fields
Page: [1]
Jump to: 1





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