Jump to content
  • 0
Sign in to follow this  
haxx0r

Display field results in a header

Question

Hi, I wanted to display the field results into my header, but as I try display it, it is only showing 1 record,  but I need all the record that matches in my search field. So I have this Report DataPage that a search field for Roles. and on the results Page it is displaying a list of Names. What I wanted is that I should display all the Names in the header of the DataPage. but I can't seem to know how to do it.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi haxx0r,  This can be achieved within Caspio, it requires custom programming to display all the Names in to the header. You may apply this simple JavaScript code into your DataPage and see if it works on your workflow. First, Add this code inside your header, please do not forget to disable the html editor:

<div id="names"> </div>
<script>
var array = [];
</script>
This script basically creates a <div> where all the Names will be display, and also created an array where all the names will be stored.

Second, add a new HTML Block and use this code:
<script>
array.push("[@field:Name]");
</script> 
This script will store the Name values in to the array that you just created.

And lastly, Add this code into your footer:
<script>
var name_from_table= '';
array.forEach(function(name) {
    name_from_table += name + "<br/>";
document.getElementById("names").innerHTML = "<p>" + name_from_table + "</p>"
  });
</script>

This code will now get all the values from the array that you created, and it will display the values in to the <div> that you've created in the header section.

I hope this works in your workflow.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...