How to hide the map if no records found on the result page?

FacebookLinkedInStumbleUponTwitterShare

Question:

How to hide the map if no records found on the result page?

 

Answer:

1. Edit the Localization

(a) Navigate to the Localizations view in the Exploring window and select the localization the Report DataPage is using. Click on the Edit button to open the Localization wizard.

(b) Go to the Settings screen, and select Forms/Details Pages >> Messages from the Categories panel. On the right panel, select the Element ID # 351. Enable custom text for the “No records found” message. Place the following code into the custom text area to assign a unique ID to the message:

 <div id="norecord"><h1>No records found.</h1></div>

Caspio customizing No Record Found

 

2. Edit the Report DataPage

(a) Navigate to the DataPages view in the Exploring window and select the Report DataPage. Click on the Edit button to open the Report wizard.

(b) Go to the Configure Results Page Fields screen, and insert a pair of Header & Footer. Paste the following code into the Footer:

 

<script type="text/javascript">
if (document.getElementById("norecord"))
{
document.getElementById("map").style.display = "none";
}
</script>

 

Make sure the div ID you have assigned (in this example "norecord") is the same in both the Localization message and the JavaScript code.

Contact Support

Leave a Reply

 
© 2011 Caspio, Inc. All rights reserved! Sitemap | Terms of Use | Privacy Statement Suffusion theme by Sayontan Sinha