File: vspx_form.xml

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (228 lines) | stat: -rw-r--r-- 8,778 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
<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 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
 -  
 -  
-->
<refentry id="vspx_form">
<refmeta>
  <refentrytitle>vspx_form</refentrytitle>
  <refmiscinfo>vspx_control</refmiscinfo>
</refmeta>
<refnamediv>
  <refname>vspx_form</refname>
  <refpurpose>generic scriptable container
		</refpurpose>
</refnamediv>
<refsynopsisdiv>
  <funcsynopsis id="syn_vspx_form">
    <funcprototype id="proto_vspx_form">
      <funcdef>
        <function>form</function>
      </funcdef>
      <attributes>
        <attribute>name (required) </attribute>
        <attribute>annotation (optional) </attribute>
        <attribute>initial-enable (optional) </attribute>
        <attribute>type (optional) </attribute>
        <attribute>action (optional) </attribute>
        <attribute>method (optional) </attribute>
        <attribute>table (optional) </attribute>
        <attribute>if-not-exists (optional) </attribute>
      </attributes>
      <childs>
        <child>after-data-bind</child>
        <child>after-data-bind-container</child>
        <child>before-data-bind</child>
        <child>before-data-bind-container</child>
        <child>on-post</child>
        <child>on-post-container</child>
        <child>before-render</child>
        <child>before-render-container</child>
        <child>radio-button</child>
        <child>button</child>
        <child>check-box</child>
        <child>select-list</child>
        <child>textarea</child>
        <child>text</child>
        <child>update-field</child>
        <child>key</child>
        <child>variable</child>
        <child>label</child>
        <child>url</child>
        <child>data-grid</child>
        <child>data-set</child>
        <child>data-list</child>
        <child>tab</child>
        <child>tree</child>
        <child>include</child>
        <child>error-summary</child>
        <child>template</child>
      </childs>
      <class>
        <screen><![CDATA[
		
		-- the form super class
		create type vspx_form under vspx_control
		as
		(
		 uf_action varchar default '',  	-- target URI
		 uf_method varchar default 'POST',	-- HTTP transfer method
		 uf_inside_form int default 0,		-- designate is under other form, if true will not be printed
		 uf_validators any			-- internal use	
		) temporary self as ref
		;

		-- the updatable form subclass
		create type vspx_update_form under vspx_form
		as (
		    uf_keys  any,			-- key column names
		    uf_fields any,			-- data column names
		    uf_row any,				-- internal use
		    uf_table varchar,			-- target table 
		    uf_if_not_exists int,		-- what to do if no data found
		    uf_concurrency int			-- internal use
		   ) temporary self as ref
		overriding method vc_view_state (stream any) returns any
		;

		
		]]>
        </screen>
      </class>
    </funcprototype>
  </funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_vspx_form">
  <title>Description</title>
  <para>
    <function>vspx_form</function>is a container for elements that may accept user&#39;s input.
    The basic functionality is to be a grouping element for controls that handles post data and validation of user&#39;s input. In case of type &#39;update&#39;, this is a single row update control for a database table.
This retrieves the data from the row identified by the keys and shows the data in the column bound fields enclosed.  If responding to a post for a submit inside this form, the form updates/inserts the data and shows the resulting state at the render pass.
</para>
</refsect1>
<refsect1 id="attrs_vspx_form">
  <title>Attributes</title>
  <refsect2>
    <title>name</title>
    <para>A unique name identifying the control.</para>
  </refsect2>
  <refsect2>
    <title>annotation</title>
    <para>A human readable comment.</para>
  </refsect2>
  <refsect2>
    <title>initial-enable</title>
    <para>Designates is control visible or not initially. Could be data-bound to an SQL expression.</para>
  </refsect2>
  <refsect2>
    <title>type</title>
    <para>A type of form, can be &#39;simple&#39; or &#39;update&#39;. When it&#39;s &#39;simple&#39; the vspx_form class will be instantiated, otherwise in case of &#39;update&#39; vspx_update_form subclass will be used.</para>
    <para>
         &#39;simple&#39; : 
Form with no special data binding.
</para>
    <para>
         &#39;update&#39; : 
Form that may be used in templates of type &#39;update&#39; or &#39;add&#39;.
</para>
  </refsect2>
  <refsect2>
    <title>action</title>
    <para>
      A URL for processing. The data filled-in the form will be submitted to the &#39;action&#39; page.
      Therefore this is a page where will be processed the content of that form.
      If it&#39;s empty, the target is a current page.
				 </para>
  </refsect2>
  <refsect2>
    <title>method</title>
    <para>A way of transferring the form data, can be POST or GET. The same as &#39;method&#39; of HTML forms.
				 </para>
    <para>
         &#39;GET&#39; : </para>
    <para>
         &#39;POST&#39; : </para>
  </refsect2>
  <refsect2>
    <title>table</title>
    <para>If the value of &#39;type&#39; attribute is &#39;update&#39;, the form acts as a single row update control for a database table; and the value of &#39;table&#39; attribute specifies the name of that table.
It retrieves the data from the row identified by the keys and shows the data in the column bound fields enclosed.  If responding to a post for a submit inside this form, the form updates/inserts the data and shows the resulting state at the render pass.
This attribute is required if &#39;type&#39; is &#39;update&#39; and prohibited otherwise.</para>
  </refsect2>
  <refsect2>
    <title>if-not-exists</title>
    <para>If the keys do not select any row, and the value of this attribute is &#39;insert&#39;, the update form will be filled in with defaults filled in and will do an insert into the table when the form is submitted.
In this case of course the keys will have to be defaulted after the post or will have to be supplied in the post as fields.
Any defaulting should take place in the v:on-post handler which is before the insert or update in the event of the post.
</para>
    <para>
         &#39;insert&#39; : </para>
    <para>
         &#39;none&#39; : </para>
  </refsect2>
</refsect1>
<refsect1 id="childs_vspx_form">
  <title>Children</title>
  <refsect2>
    <title>template</title>
    <para>The container for any optional, repeatable or otherwise grouped controls or code. The type modifier is used to specify special kind of templates (i.e. repeatable content or tree node representation)</para>
  </refsect2>
  <refsect2>
    <title>key</title>
    <para>Defines a key value of the vspx:form of type &#39;update&#39;.
All the vspx:key children together should select one or zero rows from the table.
</para>
  </refsect2>
  <refsect2>
    <title>update-field</title>
    <para>The vspx:update-field is used to bind to individual columns of a table.
It may appear only inside the vspx:form of type &#39;update&#39;.
At posting time the post message is
addressed to the button first, then to the fields then to the form.
Validators can appear as children of the form.
The field validation is invoked before the form gets control.
For the form, all validators are evaluated first and if successful the post
processing of the form continues.
</para>
  </refsect2>
</refsect1>
<refsect1 id="examples_vspx_form">
  <title>Examples</title>
  <example id="ex_vspx_form">
    <title>Simple example</title>
    <para>This is to build simple entry form</para>
    <screen><![CDATA[
<html>
<body>
<v:page name="page01" xmlns:v="http://example.com/vspx/" >
  <v:form name="form01" type="simple" action="" method="POST">
    <v:label name="label01" value="--'Simple form'" />
    <v:text name="txt01" default="" />
    <v:text name="txt02" default="" />
    <v:button name="submit01" action="simple" value="OK" />
  </v:form>
</v:page>
</body>
</html>
		]]>
    </screen>
  </example>
</refsect1>
</refentry>