File: vc_check_box.xml

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (326 lines) | stat: -rw-r--r-- 20,063 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<refentry id="vc_check_box">
  <refmeta>
  <refentrytitle>check-box</refentrytitle>
  <refmiscinfo>vspx_control</refmiscinfo>
  </refmeta>
  <refnamediv>
  <refname>check-box</refname>
  <refpurpose>Scriptable check-box.</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
   <funcsynopsis id="vc_syn_check_box">
    <funcprototype id="vc_proto_check_box">
      <funcdef>
            &lt;<function>check-box</function> <attribute>
          <parameter>name</parameter> (required) </attribute>
        <attribute>
          <parameter>annotation</parameter> (optional) </attribute>
        <attribute>
          <parameter>initial-enable</parameter> (optional) </attribute>
        <attribute>
          <parameter>enabled</parameter> (optional) </attribute>
        <attribute>
          <parameter>instantiate</parameter> (optional) </attribute>
        <attribute>
          <parameter>control-udt</parameter> (optional) </attribute>
        <attribute>
          <parameter>xsd-stub-xhtml</parameter> (optional) </attribute>
        <attribute>
          <parameter>width</parameter> (optional) </attribute>
        <attribute>
          <parameter>height</parameter> (optional) </attribute>
        <attribute>
          <parameter>column</parameter> (optional) </attribute>
        <attribute>
          <parameter>null-value</parameter> (optional) </attribute>
        <attribute>
          <parameter>error-glyph</parameter> (optional) </attribute>
        <attribute>
          <parameter>auto-submit</parameter> (optional) </attribute>
        <attribute>
          <parameter>value</parameter> (optional) </attribute>
        <attribute>
          <parameter>element-value</parameter> (optional) </attribute>
        <attribute>
          <parameter>element-place</parameter> (optional) </attribute>
        <attribute>
          <parameter>element-path</parameter> (optional) </attribute>
        <attribute>
          <parameter>element-params</parameter> (optional) </attribute>
        <attribute>
          <parameter>element-update-path</parameter> (optional) </attribute>
        <attribute>
          <parameter>element-update-params</parameter> (optional) </attribute>
        <attribute>
          <parameter>fmt-function</parameter> (optional) </attribute>
        <attribute>
          <parameter>cvt-function</parameter> (optional) </attribute>
        <attribute>
          <parameter>group-name</parameter> (optional) </attribute>
        <attribute>
          <parameter>initial-checked</parameter> (optional) </attribute>
        <attribute>
          <parameter>is-boolean</parameter> (optional) </attribute>
        <attribute>
          <parameter>true-value</parameter> (optional) </attribute>
        <attribute>
          <parameter>false-value</parameter> (optional) </attribute>
        <attribute>
          <parameter>debug-srcfile</parameter> (optional) </attribute>
        <attribute>
          <parameter>debug-srcline</parameter> (optional) </attribute>
        <attribute>
          <parameter>debug-log</parameter> (optional) </attribute>
 /&gt;</funcdef>
    </funcprototype>
   </funcsynopsis>
  </refsynopsisdiv>
  <refsect1 id="vc_desc_check_box">
  <title>Description</title>
  <para>is a represantation of HTML check box. Scriptable, databindable.</para>
  </refsect1>
  <refsect1 id="vc_attrs_check_box">
  <title>Attributes</title>
  <formalpara>
   <title>name = <link linkend="vc_type_SqlName">SqlName</link>
   </title>
    <para>A page level unique name identifying a control.</para>
  </formalpara>
  <formalpara>
    <title>annotation</title>
    <para>A human readable comment.</para>
  </formalpara>
  <formalpara>
   <title>initial-enable = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Determines  whether  a control is initially visible. True by default. Could be data-bound to an SQL expression.</para>
  </formalpara>
  <formalpara>
   <title>enabled = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Determines  whether  a control is visible. True by default. Could be data-bound to an SQL expression.</para>
  </formalpara>
  <formalpara>
   <title>instantiate = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Determines whether a control instantiate its children. It is true by default. It could be data-bound to an SQL expression. Unlike most of calcucateable attributes, the value of this attribute for a control is calcluated before calling &#39;on-init&#39; event handler of the control; other values are calculated before calling &#39;before-data-bind&#39; event handler.</para>
  </formalpara>
  <formalpara>
   <title>control-udt = <link linkend="vc_type_SqlName">SqlName</link>
   </title>
    <para>At run time every control is represented as an instance of some user-defined type (UDT). VSPX compiles selects the UDT to use depending on name of the XML element that represents the control and maybe some of its attributes. In some specific cases the application developer may instruct VSPX compiler to use some other UDT, e.g. an application-specific UDT that is derived from the preset one. If specified, the value of &#39;control-udt&#39; attribute should be equal to the name of the desired target UDT.</para>
  </formalpara>
  <formalpara>
    <title>xsd-stub-xhtml</title>
    <para>This attribute is for internal use only. It has no effect if added to the source VSPX file.</para>
  </formalpara>
  <formalpara>
    <title>width</title>
    <para>Visible width of the control when it is displayed in WYSIWYG tools when the source VSPX text is edited.
The value of this attribute will not be used when the resulting HTML is rendered.</para>
  </formalpara>
  <formalpara>
    <title>height</title>
    <para>Visible width of the control when it is displayed in WYSIWYG tools when the source VSPX text is edited.
The value of this attribute will not be used when the resulting HTML is rendered.</para>
  </formalpara>
  <formalpara>
   <title>column = <link linkend="vc_type_SqlName">SqlName</link>
   </title>
    <para>The name of the column bound.
If nothing else is specified, the column meta data from the containing update form sets the field&#39;s attributes.
</para>
  </formalpara>
  <formalpara>
    <title>null-value</title>
    <para>This value will be shown if value of the column is NULL, also
	      value of the control will be set to null if this value is passed upon POST request.
	  </para>
  </formalpara>
  <formalpara>
    <title>error-glyph</title>
    <para>The character to be displayed near the resulting HTML input element if the test of v:validator of the element detects an error in the current value of the element.</para>
  </formalpara>
  <formalpara>
    <title>auto-submit</title>
    <para>Flag to auto submit the parent form if value of the control is changed.</para>
  </formalpara>
  <formalpara>
   <title>value = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Data bindable value of control, represents value of HTML control to be drawn.
The calculated value of this attribute is stored in the control in ufl_value field.
</para>
  </formalpara>
  <formalpara>
   <title>element-value = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>An XML entity that contains a value to be displayed by an HTML control.
The calculated value is stored in ufl_element_value field of the control.
This value is used only if ufl_value is null (e.g. if the &#39;value&#39; attribute is not set at all), and the method vc_get_value_from_element() will be used to calculate ufl_value based on ufl_element_value, ufl_element_path and ufl_element_place.
</para>
  </formalpara>
  <formalpara>
   <title>element-place = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>The place of actual data inside an XML element. The calculated value of this attribute is stored in ufl_element_place field of the control. This is to process XMLSchema-compatible data without writing extra code for handling NULL values. The XML element can contain the value to be bound in either attribute or in an inner text node. XMLSchema treats missing attributes as NULL values. missing text node as an empty string value and if &#39;xsi:nil&#39; attribute is &#39;true&#39; then inner text value is NULL no matter if there are any text nodes. These self-evident rules are convenient for XQuery data retrieval but not for data update: an result of some XQuery expression can point to data but not to a place where data should occur in the future.
The use of &#39;element-place&#39; allows to eliminate the problem. Attributes &#39;element-value&#39;, &#39;element-path&#39; and &#39;element-update-path&#39; may locate an element that is always present whereas &#39;element-place&#39; describes where the desired datum will occur in the element.
The value of this attribute should be a string of syntax &#39;@attributename&#39; or &#39;text()&#39;. If this is &#39;@attributename&#39; then the effective bound value is a value of the specified attribute or NULL if the specified attribute is missing. On update, either the attribute is created/edited in order to set non-NULL value or the attribute is deleted in order to set NULL.
If text() is specified then both text value of the element and the value of its &#39;xsi:nil&#39; are properly handled on both data bind and update.</para>
  </formalpara>
  <formalpara>
   <title>element-path = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This is the path inside the entity that comes from &#39;element-value&#39; attribute. The default path is &#39;self::node()&#39;. This path is used to point precisely to an subentity that should actually be used for data binding. The calculated value of this attribute should be a string in XQuery syntax, and it is saved in ufl_element_path member of the control.</para>
  </formalpara>
  <formalpara>
   <title>element-params = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This is the vector of parameter values of the path specified by &#39;element-path&#39; attribute. The default is NULL indicating no parameters. The attribute is calculated but not used if &#39;element-path&#39; attribute is missing. The calculated value of this attribute should be either NULL or a vector of even length whose items are parameter names and parameter values; refer to the description of xquery_eval() function for more details. The value of the attribute is saved in ufl_element_params member of the control.</para>
  </formalpara>
  <formalpara>
   <title>element-update-path = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Like the value of &#39;element-path&#39;, this is the path inside the entity that comes from &#39;element-value&#39; attribute. The difference is that &#39;element-path&#39; is used inside &#39;vc_get_value_from_element() during data-bind to set ufl_value based on ufl_element_value whereas &#39;element-update-path&#39; is used during data update inside &#39;vc_put_value_to_element() in order to save data inside the document that is referenced by ufl_element_value. The default path for update is equal to the path for data bind, i.e. it is the value of the calculated &#39;element-path&#39; attribute or &#39;self::node()&#39;. The calculated value of &#39;element-update-path&#39; should be a string in XQuery syntax, and it is saved in ufl_element_update_path member of the control.</para>
  </formalpara>
  <formalpara>
   <title>element-update-params = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This is the vector of parameter values of the path specified by &#39;element-update-path&#39; attribute. The default is NULL indicating no parameters. The attribute is calculated but not used if &#39;element-update-path&#39; attribute is missing (e.g. you should not try to specify &#39;element-path&#39; without &#39;element-update-path&#39; and both &#39;element-params&#39; and &#39;element-update-params&#39; in hope that values from &#39;element-update-params&#39; will be passed to &#39;element-path&#39; on update). The calculated value of this attribute should be either NULL or a vector of even length whose items are parameter names and parameter values; refer to the description of xquery_eval() function for more details. The value of the attribute is saved in ufl_element_update_params member of the control.</para>
  </formalpara>
  <formalpara>
   <title>fmt-function = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This is to convert the value that is bound to the control into a string to use during the rendering. The value of this attribute should be a name of function that takes a single argument of the type that matches the type of ufl_value and returns a string. If this is used then the value of &#39;cvt-function&#39; should probably be a name of function that converts the string back to the desired data type.
If a control supports &#39;format&#39; attribute then the format is applied to the result of &#39;fmt-function&#39;, so the value returned by fmt-function may be e.g. an integer to be formatted by &#39;%d&#39; format.
The calculated value of this attribute is stored in ufl_fmt_fn field of the control.</para>
  </formalpara>
  <formalpara>
   <title>cvt-function = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This is to convert a user input of type varchar into a value that should be stored in ufl_value (and e.g. placed into some database column by an update).
The calculated value of this attribute is stored in ufl_cvt_fn field of the control.
For more details, see the description of &#39;fmt_function&#39; attribute above.</para>
  </formalpara>
  <formalpara>
   <title>group-name = <link linkend="vc_type_SqlName">SqlName</link>
   </title>
    <para>
When several check boxes are grouped, this is the group name.
This will be submitted instead of the control name on post.
			     </para>
  </formalpara>
  <formalpara>
   <title>initial-checked = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>Specifies whether the control is initially checked.</para>
  </formalpara>
  <formalpara>
    <title>is-boolean</title>
    <para>If this attribute is set to &#39;1&#39; then the check-box is forced to ignore its &#39;initial-checked&#39; status and work using the data-bound value as the only criterion for enabling or disabling its &#39;checked&#39; property. This mode is convenient for editing two-state data values. Before render, the control will check if the ufl_value is equal to &#39;true-value&#39; or &#39;false-value&#39;, and it is displayed as checked if the ufl_value is equal to &#39;true-value&#39; (or it is not equal to any of these two but is not a logical &#39;false&#39;). On post, a new status of the checkbox is inspected, and the ufl_value is set to &#39;true-value&#39; if it is checked or &#39;false-value&#39; otherwise.
The default value of this attribute is &#39;0&#39; meaning that there is no system-level relation between the &#39;checked&#39; status and the &#39;value&#39;.
When the form with the check-box submits data, the submitted value of the attribute depends on its &#39;is-boolean&#39; property. If it&#39;s &#39;0&#39; then the result of cast (control.ufl_value as varchar) is submitted; otherwise a string &#39;1&#39; is submitted.
</para>
  </formalpara>
  <formalpara>
   <title>true-value = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This attribute should be used if and only if &#39;is-boolean&#39; attribute is set to &#39;1&#39;.
The calculated value of this attribute is saved in ufl_true_value field of the control and is used to represent a logical &#39;true&#39; for the control. The checkbox is displayed as checked if the bound value is equal to the ufl_true_value. If the checked checkbox is submitted then the bound value of the control is set to the ufl_true_value.
</para>
  </formalpara>
  <formalpara>
   <title>false-value = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
   </title>
    <para>This attribute should be used if and only if &#39;is-boolean&#39; attribute is set to &#39;1&#39;.
The calculated value of this attribute is saved in ufl_false_value field of the control and is used to represent a logical &#39;false&#39; for the control. The checkbox is displayed as not checked if the bound value is equal to the ufl_valuse_value. If no checked checkbox is submitted by a form then the bound value of the control is set to ufl_false_value.</para>
  </formalpara>
  <formalpara>
    <title>debug-srcfile</title>
    <para>URI of the source document where the tag comes from.</para>
  </formalpara>
  <formalpara>
    <title>debug-srcline</title>
    <para>Line number in the source document where the tag comes from.</para>
  </formalpara>
  <formalpara>
    <title>debug-log</title>
    <para>This defines what sort of data are saved to the debugging log.
</para>
  </formalpara>
  </refsect1>
  <refsect1 id="vc_udt_check_box">
  <title>Declaration of type vspx_check_box</title>
  <para>
</para>
  <screen>
create type vspx_check_box under vspx_field
temporary self as ref
constructor method vspx_check_box (name varchar, parent vspx_control),
overriding method vc_render () returns any,
overriding method vc_xrender () returns any,
overriding method vc_view_state (stream any, n int) returns any,
overriding method vc_set_view_state (e vspx_event) returns any,
overriding method vc_set_model () returns any
</screen>
  </refsect1>
  <refsect1 id="vc_ex_check_box">
  <title>Examples</title>
   <example id="vc_ex_check_box__0">
    <title>
  Entry form with a checkbox
</title>
    <para>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!--
 -  
 -  $Id: check_box__0.vspx,v 1.2 2006/08/16 00:04:15 source Exp $
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2006 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  


Depending on the state of the checkbox, the submitted value is either &#39;checked&#39; or &#39;unchecked&#39;.

</para>
    <screen>
&lt;v:page name=&quot;check_box__0&quot; xmlns:v=&quot;http://www.openlinksw.com/vspx/&quot;&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;VSPX samples | v:check-box&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;v:form name=&quot;form1&quot; type=&quot;simple&quot; action=&quot;&quot; method=&quot;POST&quot;&gt;
        &lt;v:check-box name=&quot;cb1&quot; initial-checked=&quot;0&quot; value=&quot;-- case control.ufl_selected when 1 then &#39;checked&#39; else &#39;unchecked&#39; end&quot;  /&gt;
        &lt;v:button name=&quot;submit1&quot; action=&quot;simple&quot; value=&quot;OK&quot;/&gt;
      &lt;/v:form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
&lt;/v:page&gt;
</screen>
   </example>
  </refsect1>
  <tip>
  <title>See Also: Reference Material in the Tutorial:</title>
   <para>
    <ulink url="/tutorial/web/vx_s_2/check_box.vspx">VX-S-2</ulink>
   </para>
  </tip>
</refentry>