Description
One of the most powerful features in Zoho Creator is support for
creating HTML views. The HTML view enables you to create customized views
by combining HTML code and Deluge Script. You can create a static HTML
page as a view and use this page to deliver dynamic content from your
datastore using Deluge Script. The HTML Builder provides an intuitive
drag-n-drop user-interface to easily create the required HTML view. Knowledge
of HTML is not necessary. You can use the HTML view to,
- Create dashboard pages that contains a list of
reports to provide your users with quick access to the information
they need. For example, display the required reports on the left side
of the page, and a table that contains information about the application
on the right side.
- Create customized bills and invoices based on the
data stored in your application.
- Embed forms, views and third party widgets in your
HTML view and generate dynamic views by passing form data as parameters
to the view.
Steps in Defining a New HTML View
- Select Views -> New View in Edit mode.
- Select the HTML page icon, specify the view name and
the section under which the view will be displayed, and click Done
to create the HTML view.
- The HTML Builder will be displayed with the HTML, Embed
and Deluge tasks on the left-side and the text-editor on the
right-side.
- You can create your view based on a template by selecting the Choose
Template button or create your own view from scratch by inserting HTML/Deluge Tasks,
Embedding Forms/Views and Embedding Widgets.
- Click Save Script to save the view.
- Use the Show Preview tab to preview the created view.
- If you are well-versed in HTML and Deluge Scripting, you can straight
away use the Free-flow script tab to write the HTML view.
Inserting HTML and Deluge Tasks
- Drag-n-drop the Insert Html task to insert HTML tags to
your view.
- Click on the Edit button and select the Rich text mode
or the Plain text mode from the Insert HTML dialog, to insert
the required HTML.
- Use the Insert Expression button to add expressions to
your view, using the Deluge Expression Builder.

-
Drag-n-drop the Deluge Tasks to fetch and display
the records at the required positions in your view. For example,
in the screen-shot given below, the for each deluge
statement is placed after the table row header . For each
iteration of the add new income form, a new row is created
to display the Date and Amount stored in each record
(r)

Embedding Form/View
The Embed Form/View task enables you to embed Zoho Creator forms
and views within your HTML view. To do this,
- Drag-n-drop the Embed -> Form/View task to embed Zoho
Creator forms and views within the HTML view.
- The Embed dialog lists all the applications created in your accout,
in the Select Application list. Select the required application.
- Select the Form componenet to embed a form or the View
component to embed a View.
- Select the Form/View to be embedded in the HTML view.
- The Form Embed properties enables you to specify if the
form header is required, specify the next url to take you to another
page on form submit, specify customized success message and customized
submit/reset button display names.
-
Click Done to add the embed code to the HTML builder, with
the given configurations.

-
The Form embed code will be inserted in the HTML view
within the <div> tag, as given below:
|
htmlpage Sample_HTML_View()
displayname = "Sample HTML View"
content
<%{%>
<div elName='zc-component'
formLinkName='Monthly_Report_Pie_Chart' params='zc_Header=true&zc_SuccMsg=Data
Added Sucessfully!&zc_SubmitVal=Submit&zc_ResetVal=Reset'>Loading
Form...</div>
<%}%>
|
-
While embedding a view, view properties provides options to enable/disable
the display of view header, footer, secondary header and add/edit
record links, as shown below:

-
The View embed code will be inserted in the HTML view within the
<div> tag as given below, based on the options selected.
|
htmlpage Sample_HTML_View()
displayname = "Sample HTML View"
content
<%{%>
<div elName='zc-component'
viewLinkName='Expense_Report_By_Category' params='zc_Header=true'>Loading
View...</div>
<%}%>
|
Embedding Widgets
Widgets are embeddable chunks of code that can be embedded within an
HTML page. For example, advertisements, links and images from third
party sites. Generally widgets are third party originated and are also
known as modules, snippets, and plug-ins. To insert widgets to your
HTML view,
- Drag-n-drop the Embed -> Widget task from the left-side
tree to the editor area.
- Specify the width, height, scrolling, iframe border options and
widget URL in the Emded widget dialog.
- Click Done to add the embed widget code to the HTML builder.

- The embed widget code will be inserted in the HTML view
within the <iframe> tag as given below, based on the
options selected.
|
htmlpage Sample_HTML_View()
displayname = "Sample HTML View"
content
<%{%>
<iframe name='zohoview' height='100'
width='100%' frameborder='0' scrolling='auto' src=' http://zoho.com'
></iframe>
<%}%>
|
Adding Parameters to the HTML View
To pass parameters to the HTML view, use the Add Parameter button
displayed in the top-right corner of the text editor. The specified
parameters will be added to the view definition, as shown in the format
given below. In the following code, two parameters named From
and To are passed to the "Expense Report By Date" HTML
view.
|
htmlpage "Expense Report By Date"(From,
To)
<%{%>
...................
..................
}%>
|
About HTML View Tags
1. The tags used to begin and end the HTML view will be in the
following format. For example, in the HTML view given below, "Sample
HTML View" is the name of the html view. The view will insert
a table with caption "Income vs Expenditure"
|
htmlpage "Sample HTML View"()
<%{%>
<table width="100%" cellspacing="1" cellpadding="1"
border="1">
<caption>Income Vs Expenditure</caption>
<tbody>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<%}%>
|
2. The tag that will set the Deluge tasks apart from the HTML
are the <% and %> tags. If Deluge expressions are
used within an HTML, the <%= and %> is used to differentiate
it from the HTML. For example, in the code given below:
- the Deluge for each task is inserted in between the HTML
task to iterate each record, held by the variable r in
the add_new_income form.
- the Deluge for each task is enclosed within the <%
and %> tags to differentiate it from the HTML tags.
- for each iteration, a new row is created using the <tr> </tr>
html tags.
- r.Date_field and r.Amount are the Deluge expressions used
to display the data for each column in the row. The Deluge expression
is enclosed within the <%= and %> tag.
|
htmlpage "Sample HTML View"()
<%{%>
<table width="100%" cellspacing="1" cellpadding="1"
border="1">
<caption>Income Vs Expenditure</caption>
<tbody>
<%for each r in add_new_income
{%>
<tr>
<td><%=r.Date__field%>
</td>
<td> <%=r.Amount%></td>
</tr>
<%}%>
</tbody>
</table>
<%}%>
|
 Note: |
1. The tag that will set the Deluge tasks apart from the
HTML are the <% and %> tags.
2. The tag that will set the Deluge expressions apart from
the HTML are the <%= and %> tags.
3. The HTML Builder highlights the Deluge tasks in the HTML
view.
You can have as many <% and %> tags as you
need throughout your HTML view. Just remember to close each tag
before you go on!
|
Sample HTML View
Let us take the example of a Feedback Application that facilitates
the creation and assigning of bugs related to software. The Submit
Feedback form given below is used to submit and assign issues to team
members belonging to a module. The Module Name is a lookup of the
Modules form and the Assign To field is a lookup of the Team
Member form.

Given below is the screen-shot of a list view that displays
the issues submitted through the above form and assigned to team members

But assume that you want to create a summary view of the total issues
assigned to each module or total issues assigned to each team member.
This is not possible with the default views supported by Zoho Creator
like list view, grid view, or summary view. The HTML view can be used
in such scenarios to create customized mashup pages using a combination
of HTML and Deluge Scripting.
A simple HTML view that displays
the summary of issues assigned to a specific module/team member.

HTML View Code
The following code creates the HTML view shown above. The HTML tasks
( in green color) and Deluge tasks (in blue color ) are inserted
to create the required view. The <% and %> tags are
used to identify the Deluge tasks. If Deluge script is used within an
HTML, the <%= and %> is used .
|
htmlpage "Summary View"()
<%{%>
<table class=zc-viewtable width="50%" border="1"
valign="top">
<caption class="zc-viewtitle">Summary of Assigned
Issues</caption>
<tbody>
<tr>
<td valign="top">
<table class=zc-viewtable width=100% >
<caption class="zc-viewtitle">Total issues assigned
to each module</caption>
<tbody>
<tr class="zc-row-header">
<td class="zc-viewrowheader">Module Name</td>
<td class="zc-viewrowheader">Total Issues</td>
</tr>
<%for each r in Modules
{
ModuleName = r.Module_Name;
ModuleTotal = count(Submit_Feedback[Module == ModuleName]);%>
<tr class=zc-viewrow>
<td><%=ModuleName%></td>
<td><%=ModuleTotal%></td></tr>
<%}%>
</tbody>
</table>
</td>
<td valign="top">
<table class=table zc-viewtable width=100% >
<caption class="zc-viewtitle">Total issues assigned
to each team member</caption>
<tbody>
<tr class="zc-row-header">
<td class="zc-viewrowheader">Team Members</td>
<td class="zc-viewrowheader">Total Issues Assigned</td>
</tr>
<%for each x in Team_Member
{
MemberName = x.Name;
MemberTotal = count(Submit_Feedback[Assign_To == MemberName]);%>
<tr class=zc-viewrow>
<td><%=MemberName%></td>
<td><%=MemberTotal%></td></tr>
<%}%>
</tbody>
</table>
</td>
</tr>
</table>
<%}%>
|
I would like to add some CSS to the head range of the HTML page. Is that possible?
Marcel
I already have added two parameters(i.e. 'from' and 'to') to the HTML view. I want to access this view from another form and want to pass the values to these parameters to get the appropriate result. Let me know how can it be done?