Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

KnowledgeBase


How To: Incorporating HTML in different data region modes
Article TypeHow To
TitleIncorporating HTML in different data region modes
<P>How-to: Incorporating HTML in different data region modes</P>
<P>This article explains how HTML is rendered in each of the various possible display modes of a data region.</P>
<P><B>Grid mode:</B></P>
<P>A data region in grid mode will render a &lt;form&gt; tag to the HTML only if both of the following conditions are true:</P>
<OL>
<LI>The grid is not inside of a &lt;form&gt; tag in the view XML itself.</LI>
<LI>The grid is displaying record selectors.</LI></OL>
<P>A data region in grid mode will display record selectors only if all of the following conditions are true:</P>
<OL>
<LI>The <B>recordselectors</B> attribute of the data region is set to <B>True</B>.</LI>
<LI>The user browsing the view is logged in and is not in the Anonymous security group.&nbsp;</LI>
<LI>The user has Author permissions or higher on the table to which the data region is bound.</LI>
<LI>The grid is not inside of another data region that has already output a &lt;form&gt; tag (<I>e.g.</I> a data region in update mode).</LI></OL>
<P>In grid mode, the following elements in the data region will be rendered:</P>
<OL>
<LI>The caption of the data region.</LI>
<LI>The jump bar of the data region.</LI>
<LI>All fields and html blocks on the data region. Fields and HTML blocks will not be rendered if either they or one of their parent elements has a <B>displaymodes</B> or <B>displayrole</B> attribute which would cause them to be hidden.</LI>
<LI>The action bar of the data region.</LI></OL>
<P>Other items will not be rendered. For instance, in the following data region, the number of records will not be output:</P>
<BLOCKQUOTE>
<P>&lt;ws:dataregion&gt;<BR>&lt;ws:caption&gt;&lt;!--# var recordCount = 0; --&gt;This is the data region caption.&lt;/ws:caption&gt;<BR>&lt;ws:fieldbox&gt;&lt;ws:field name="Field1"&gt;&lt;ws:caption&gt;First Field&lt;/ws:caption&gt;&lt;/ws:field&gt;<BR>&lt;!--# recordCount ++--&gt;&lt;/ws:fieldbox&gt;<BR>&lt;/ws:dataregion&gt;<BR>&lt;!--# response.write("There were " + recordCount + " records.") --&gt;</P></BLOCKQUOTE>
<P>The reason is that in grid mode, the script comment block</P>
<BLOCKQUOTE>
<P>&lt;!--# recordCount ++ --&gt;</P></BLOCKQUOTE>
<P>is ignored. In order to execute script in every row of a grid, it is necessary to put that script inside of an HTML block. For instance:</P>
<BLOCKQUOTE>
<P>&lt;ws:dataregion&gt;<BR>&lt;ws:caption&gt;&lt;!--# var recordCount = 0; --&gt;This is the data region caption.&lt;/ws:caption&gt;<BR>&lt;ws:fieldbox&gt;&lt;ws:field name="Field1"&gt;&lt;ws:caption&gt;First Field&lt;/ws:caption&gt;&lt;/ws:field&gt;<BR>&lt;ws:htmlblock grid_style="display:none"&gt;&lt;!--# recordCount++--&gt;&lt;/ws:htmlblock&gt;&lt;/ws:fieldbox&gt;<BR>&lt;/ws:dataregion&gt;<BR>&lt;!--# response.write("There were " + recordCount + " records.") --&gt;</P></BLOCKQUOTE>
<P><B>Details mode:</B></P>
<P>In details mode, a &lt;form&gt; tag is never be output to the HTML stream. All of the child elements of the data region are rendered, with the exception of elements which are hidden because of the settings of their <B>displaymodes</B> or <B>displayrole</B> attribute. The jump bar, data region caption, and action bar are all rendered in separate rows in an HTML table. All of the other child elements of the data region share the cell in which they are rendered.</P>
<P><B>Update mode:</B></P>
<P>A data region in update mode will output a &lt;form&gt; tag unless it is inside of a &lt;form&gt; tag in the view XML itself. If the data region is inside of another data region which has output a &lt;form&gt; tag, then the inner data region will not be displayed. The formatting of a data region in update mode is the same as a data region in details mode.&nbsp;</P>
<P><B>Attributes of the data region:</B></P>
<P>For some of the attributes of the &lt;ws:dataregion&gt; element, you can specify values using Dataweb substitution syntax. The following attributes of the data region do not support Dataweb substitution syntax:</P>
<BLOCKQUOTE>
<P>displaymodes<BR>displayrole<BR>id<BR>showcaption<BR>sortcaptions<BR>recordselectors<BR>showfilter<BR>jumpbarposition<BR>actionbarposition</P></BLOCKQUOTE>
<P>The following attributes of the &lt;ws:dataregion&gt; element are evaluated before the query for the data region is executed, and before the <B>record</B> object is available:</P>
<BLOCKQUOTE>
<P>defaultmode<BR>pagesize<BR>class<BR>style<BR>grid_caption_class<BR>grid_caption_style<BR>redir_insert</P></BLOCKQUOTE>
<P>The following attributes are evaluated after the query for the data region is executed, and once for each record being displayed:</P>
<BLOCKQUOTE>
<P>redir_update<BR>row_style<BR>row_class<BR>row_alt_style<BR>row_alt_class</P></BLOCKQUOTE>
<P>In insert mode, or if there are no records displayed, the above attributes will never be evaluated.</P>
<P><B>The record object:</B></P>
<P>The values of the current record can be obtained through script by referencing the global object variable <B>record</B>. Each field included within a &lt;ws:dataregion&gt; tag is available as a property of the <B>record</B> object, and its value for the current record is available via the <B>record.fieldname</B> syntax. For lookups to other tables, the value of the field is returned through the following syntax:</P>
<BLOCKQUOTE>
<P>record[lookupfield:displayfield]</P></BLOCKQUOTE>
<P>The <B>record</B> object does not necessarily provide the values of all the fields in the table. The following fields will be available:</P>
<OL>
<LI>All of the &lt;ws:field&gt; tags inside of the data region.</LI>
<LI>All of the fields referenced by &lt;ws:select&gt; tags inside of &lt;ws:field&gt;</LI>
<LI>The fields named in the "joinfieldparent" properties of nested data regions</LI></OL>
<P>To make a field available on the record object without displaying it in the data region, add the field to the data region and set its <B>displaymodes</B> attribute to "never". Or, you can put the field inside of the &lt;ws:datasource&gt; tag. For example:</P>
<BLOCKQUOTE>
<P>&lt;ws:dataregion&gt;<BR>&lt;ws:datasource src="addressbook"&gt;<BR>&lt;ws:field name="username" /&gt;<BR>&lt;/ws:datasource&gt;<BR>&lt;ws:htmlblock&gt;User name is #record.username#.&lt;/ws:htmlblock&gt;<BR>&lt;/ws:dataregion&gt;</P></BLOCKQUOTE>
<P>In details and grid mode, the values of the properties of the record object can be changed, but this has no effect on the value displayed for a field in the data region. In update and insert mode, the properties of the record object can be changed, and the values provided will appear as the default values of the editable fields in that data region. If the field is not editable within the data region, and the value of the property on the record object has been modified, then the a hidden field will be included on the form that is submitted. For example:</P>
<BLOCKQUOTE>
<P>&lt;ws:dataregion defaultmode="update"&gt;<BR>&lt;ws:caption&gt;&lt;!--# record.Field1 = "New Value" --&gt;Data region caption&lt;/ws:caption&gt;<BR>&lt;ws:fieldbox&gt;&lt;ws:field name="Field1" editmodes="none"&gt;<BR>&lt;ws:caption&gt;You can't edit this, but this is the value which will be submitted&lt;/ws:caption&gt;&lt;/ws:field&gt;<BR>&lt;/ws:fieldbox&gt;<BR>&lt;/ws:dataregion&gt;</P></BLOCKQUOTE>
<P>This example will output the following tag to the HTML form:</P>
<BLOCKQUOTE>
<P>&lt;input type="hidden" name="Field1"&gt;</P></BLOCKQUOTE>
Last ReviewedFebruary 20, 2015 14:08:11

  
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us