close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to create a rule "do not show if blank"

Thread began 3/02/2010 10:14 pm by elewis93815 | Last modified 3/11/2010 11:50 am by Jason Byrnes | 2059 views | 6 replies |

elewis93815

How to create a rule "do not show if blank"

We have created a search that in some cases will have fields that are null in our table. We would like the results page to not show the blank fields as spaces. If we have a search for a person that has a "name, address and phone" and the next has just "name and phone" we would like the space for "address" to not show. I assume that we should create a rule somewhere on this page that says "don't show if null" or along those lines. We are fairly new to this function so any assistance would be greatly appreciated.
Thanks

Sign in to reply to this post

John LangerBeta Tester

Hi,

This is fairly easy using a bit of PHP. Below is an example of NOT showing a table row if a column is empty.

If want to do the opposite (Only show it if it has a value) then change !="" to ==""

The first is saying show if the column is NOT empty (it HAS a value), the second is Show if the column IS empty (It DOESN'T have a value). This is useful for displaying a "No results found" message.

php:
<?php if ($row_rsRecordset['address']!=""){ ?>

<tr>
<th>Address:</th>
<td><?php echo $row_rsRecordset['address']; ?></td>
</tr>
<?php ?>
Sign in to reply to this post

Jason ByrnesWebAssist

You may also want to modify the if statement to check for null in addition to a blank record:

php:
<?php if (($row_rsRecordset['address'] != "") && ($row_rsRecordset['address'] != NULL)){ ?>
Sign in to reply to this post

elewis93815

Hi, we are still struggling with this purposed solution we would greatly appreciate it if someone from your support team would contact us as soon as possible. We are on a deadline and need to resolve this today please. We hope that this is a simple task, however we are not clear on the direction. The website url is: www.themaverickinstitute.com

OUR GOAL: We would like to get rid of the space between records that have no data, but have a data field (& remove the blue lines)

Our contact info is: 952.583.5616

Thank you very much for your assistance!!!

Jackie or Erick
E.L. Lewis Enterprises Incorporated

Sign in to reply to this post

Jason ByrnesWebAssist

did you see my previous reply about adding a check for null to the if statement?

if it is not working, can you send a copy of your page so I can examine the code?

Sign in to reply to this post

elewis93815

DataAssist

We did read your thread, however would appreciate some enlightening to where this code belongs, we looked at our code (we're novices) and do not see where to alter or change what the WA plugin has created.

I've attached the files for your review,

Thank you very much!

Erick

Attached Files
northstar WA.zip
Sign in to reply to this post

Jason ByrnesWebAssist

exactly where the code goes depends on where you want to use it.


lets take the detail page as an example.

the code to display the First name is:

php:
<tr>

          <th class="WADADataTableHeader">FirstName:</th>
          <td class="WADADataTableCell"><?php echo($row_WADArick['FirstName']); ?></td>
        </tr>




to suppress the first name row from being created if the first name is empty or null, you add the if statement around it:

php:
<?php if(($row_WADArick['FirstName'] != "" ) && ($row_WADArick['FirstName'] != NULL)) { ?><tr>

          <th class="WADADataTableHeader">FirstName:</th>
          <td class="WADADataTableCell"><?php echo($row_WADArick['FirstName']); ?></td>
        </tr><?php ?>





or if you wish to suppress the last name change:

php:
<tr>

          <th class="WADADataTableHeader">LastName:</th>
          <td class="WADADataTableCell"><?php echo($row_WADArick['LastName']); ?></td>
        </tr>




to:

php:
<?php if(($row_WADArick['LastName'] != "" ) && ($row_WADArick['LastName'] != NULL)) { ?><tr>

          <th class="WADADataTableHeader">LastName:</th>
          <td class="WADADataTableCell"><?php echo($row_WADArick['LastName']); ?></td>
        </tr><?php ?>
Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...