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 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
|
<refentry id="vc_button">
<refmeta>
<refentrytitle>button</refentrytitle>
<refmiscinfo>vspx_control</refmiscinfo>
</refmeta>
<refnamediv>
<refname>button</refname>
<refpurpose>Scriptable button.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="vc_syn_button">
<funcprototype id="vc_proto_button">
<funcdef>
<<function>button</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>action</parameter> (required) </attribute>
<attribute>
<parameter>value</parameter> (required) </attribute>
<attribute>
<parameter>style</parameter> (optional) </attribute>
<attribute>
<parameter>active</parameter> (optional) </attribute>
<attribute>
<parameter>initial-active</parameter> (optional) </attribute>
<attribute>
<parameter>child-window-options</parameter> (optional) </attribute>
<attribute>
<parameter>browser-current</parameter> (optional) </attribute>
<attribute>
<parameter>browser-filter</parameter> (optional) </attribute>
<attribute>
<parameter>browser-list</parameter> (optional) </attribute>
<attribute>
<parameter>browser-mode</parameter> (optional) </attribute>
<attribute>
<parameter>browser-type</parameter> (optional) </attribute>
<attribute>
<parameter>browser-xfer</parameter> (optional) </attribute>
<attribute>
<parameter>selector</parameter> (optional) </attribute>
<attribute>
<parameter>format</parameter> (optional) </attribute>
<attribute>
<parameter>debug-srcfile</parameter> (optional) </attribute>
<attribute>
<parameter>debug-srcline</parameter> (optional) </attribute>
<attribute>
<parameter>debug-log</parameter> (optional) </attribute>
/></funcdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="vc_desc_button">
<title>Description</title>
<para>Scriptable version of Submit Button of the HTML form. Depending of
'action' attribute it may have variants. In some of these variants the button will not have a submit function, as in select and browse buttons. In these cases the button will use client JavaScript to pop up new windows or for setting values in other windows.
</para>
</refsect1>
<refsect1 id="vc_attrs_button">
<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 'on-init' event handler of the control; other values are calculated before calling 'before-data-bind' 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 'control-udt' 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'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>action</title>
<para>This specifies the button subclass to use.</para>
<table>
<title>Allowed values of the 'action' attribute</title>
<tgroup cols="2">
<tbody>
<row>
<entry>simple</entry>
<entry>
<para>is a simple submit button, no special functions
</para>
</entry>
</row>
<row>
<entry>submit</entry>
<entry>
<para>an alias of 'simple' button, obsolete
</para>
</entry>
</row>
<row>
<entry>delete</entry>
<entry>
<para>a button for deleting a row in a data-set or data-grid control. This is represented as a submit button with a special on-post script. The delete function is performed based on table, key attributes. (check implementation!!)
</para>
</entry>
</row>
<row>
<entry>browse</entry>
<entry>
<para>Button that opens pup-up window using client-side javascript (browse-button).
This control allows the designer to place some part of a form's input into a pop-up window. When the HTML page is rendered, this control puts a button and associated client-side javascript into the resulting page so clicking the button opens a child window. </para>
</entry>
</row>
<row>
<entry>return</entry>
<entry>
<para>
This is to be used on a page invoked for selecting from a browse button. Specifies that the value of the fields designated by the field children are to be asigned to the corresponding fields of the invoking page.
</para>
</entry>
</row>
<row>
<entry>logout</entry>
<entry>
<para> This will terminate the current session when clicked. Can only occur inside the login control.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</formalpara>
<formalpara>
<title>value = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>Text of the label of the button.</para>
</formalpara>
<formalpara>
<title>style</title>
<para>A style of button, affects appearance.</para>
<table>
<title>Allowed values of the 'style' attribute</title>
<tgroup cols="2">
<tbody>
<row>
<entry>submit</entry>
<entry>
<para>This is a default style used, no special handling.
The button will be rendered as a usual submit button.
</para>
</entry>
</row>
<row>
<entry>url</entry>
<entry>
<para>The button will be rendered as a link, furthermore client side JavaScript code will be produced to act as submit button. </para>
</entry>
</row>
<row>
<entry>image</entry>
<entry>
<para>The button will be rendered as an image on the browser under link button. In that case value of button control must be link to the image file.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</formalpara>
<formalpara>
<title>active = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>A data bound value to enable or disable the button. The default is '1' meaning 'enable'.</para>
</formalpara>
<formalpara>
<title>initial-active = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>A data bound value to enable or disable the button. The default is '1' meaning 'enable'.
Unlike 'active' attribute, this one is effective only when the page is displayed in the first time, not after user posts data back to the page.</para>
</formalpara>
<formalpara>
<title>child-window-options</title>
<para>Options for oppening a child pop-up window.This can be used only in conjuction with action browse.</para>
</formalpara>
<formalpara>
<title>browser-current</title>
<para>Current directory of browsing. Can be used only with browse button for WebDAV or File system resources.</para>
</formalpara>
<formalpara>
<title>browser-filter</title>
<para>Filter expression(s) for browsing. (see above)</para>
</formalpara>
<formalpara>
<title>browser-list</title>
<para>Type of browser list, 0 - short, 1 - long</para>
</formalpara>
<formalpara>
<title>browser-mode</title>
<para>COL, RES or STANDALONE , for a file system or DAV browse button, this specifies whether to return an path name or internal ID.
</para>
</formalpara>
<formalpara>
<title>browser-type</title>
<para>This designates the type of browser: dav or OS (filesystem).</para>
</formalpara>
<formalpara>
<title>browser-xfer</title>
<para>For a browse button, this is the means of transferring the data between windows, DOM is default. No other options in current implementation.</para>
</formalpara>
<formalpara>
<title>selector</title>
<para>For a browse button this is the URL that will be loaded into the pop up window.</para>
</formalpara>
<formalpara>
<title>format = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>A sprintf format string for printing the 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_button">
<title>Declaration of type vspx_button</title>
<para>
Button class, encapsulate all controls originating a event
</para>
<screen>
create type vspx_button under vspx_field as
(
bt_pressed int default 0,
bt_style varchar default 'submit',
bt_close_img varchar,
bt_open_img varchar,
bt_url varchar default '',
bt_l_pars varchar default '',
bt_text varchar default '',
bt_anchor int default 0
) temporary self as ref
overriding method vc_render () returns any,
overriding method vc_xrender () returns any,
overriding method vc_set_model () returns any,
constructor method vspx_button (name varchar, parent vspx_control)
</screen>
</refsect1>
<refsect1 id="vc_ex_button">
<title>Examples</title>
<example id="vc_ex_button__0">
<title>
Buton shown as an image
</title>
<para>
<?xml version="1.0"?>
<!--
-
- $Id: button__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
-
-
The button of the form will be shown as a picture plus.gif. Attributes whose names start with 'xhtml_' are
placed into the resulting HTML with no changes.
</para>
<screen>
<v:page name="button__0" xmlns:v="http://www.openlinksw.com/vspx/">
<html>
<head>
<title>VSPX samples | v:button</title>
</head>
<body>
<v:form name="form1" type="simple" action="" method="POST">
<v:text name="txt1" default=""/>
<v:button name="submit1" action="simple" style="image" xhtml_alt="A test button" value="--'plus.gif'" />
</v:form>
</body>
</html>
</v:page>
</screen>
</example>
<example id="vc_ex_button__1">
<title>
Simple 'Add-Number' example
</title>
<para>
<?xml version="1.0"?>
<!--
-
- $Id: button__1.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
-
-
The form accepts two numbers and calculates their sum.
</para>
<screen>
<v:page name="button__1" xmlns:v="http://www.openlinksw.com/vspx/">
<html>
<head>
<title>VSPX samples | v:button</title>
</head>
<body>
<v:form name="f1" type="simple" action="" method="POST">
<v:label name="l1" value="--0" format="%.2f" /><br/>
<v:text name="t1" default="0"/>
<v:text name="t2" default="0"/>
<v:button name="b1" action="simple" value="Add" >
<v:on-post>
self.l1.ufl_value := atof (self.t1.ufl_value) + atof (self.t2.ufl_value);
</v:on-post>
</v:button>
</v:form>
</body>
</html>
</v:page>
</screen>
</example>
<example id="vc_ex_button__2">
<title>
Simple 'Browse File' dialog
</title>
<para>
<?xml version="1.0"?>
<!--
-
- $Id: button__2.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
-
-
The form allows to select a file from server's file system
<html>
<body>
</para>
<screen>
<v:page name="browse__2" xmlns:v="http://www.openlinksw.com/vspx/">
<v:form name="f1" type="simple" method="POST">
<v:text name="floc" value="" xhtml_size="60%" />
<v:button action='browse' name="cmb" selector="browser/dav_browser.vsp"
child-window-options="resizable=yes, status=no, menubar=no, scrollbars=no, width=640, height=400"
value="Browse"
browser-type="os"
browser-mode="RES"
browser-xfer="DOM"
browser-list="1"
browser-current="1"
browser-filter="*">
<v:field name="floc" />
</v:button>
</v:form>
</v:page>
</body>
</html>
</screen>
</example>
<example id="vc_ex_button__3">
<title>
Simple browse button example
</title>
<para>
<?xml version="1.0"?>
<!--
-
- $Id: button__3.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
-
-
The form allows to select a two values from a different page
<html>
<body>
</para>
<screen>
<v:page name="button__3" xmlns:v="http://www.openlinksw.com/vspx/">
<v:form name="frm" type="simple" method="POST">
<v:text name="fld1" value="" />
<v:text name="fld2" value="" />
<v:button action='browse' name="br1" selector="button__4.vspx"
child-window-options="scrollbars=yes, menubar=no, height=630, width=600"
value="Browse">
<v:field name="fld1" />
<v:field name="fld2" />
</v:button>
</v:form>
</v:page>
</body>
</html>
</screen>
</example>
<example id="vc_ex_button__4">
<title>
Simple select button example
</title>
<para>
<?xml version="1.0"?>
<!--
-
- $Id: button__4.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
-
-
The form returns back to caller form two walues from a text box and select list
<html>
<body>
</para>
<screen>
<v:page name="button__4" xmlns:v="http://www.openlinksw.com/vspx/">
<v:form name="f1" type="simple" method="POST">
<v:text name="sl1" value="Test" />
<v:select-list name="sl2">
<v:item name="*default*" value="0" />
<v:item name="FIRST" value="1" />
<v:item name="SECOND" value="2" />
</v:select-list>
<v:button name="select1" action="return" value="Select">
<v:field name="fld1" ref="sl1" />
<v:field name="fld2" ref="sl2" />
</v:button>
</v:form>
</v:page>
</body>
</html>
</screen>
</example>
</refsect1>
<tip>
<title>See Also: Reference Material in the Tutorial:</title>
<para>
<ulink url="/tutorial/web/vx_s_2/form.vspx">VX-S-2</ulink>
</para>
<para>
<ulink url="/tutorial/web/vx_s_7/products.vspx">VX-S-7</ulink>
</para>
</tip>
</refentry>
|