| Server IP : 121.121.20.254 / Your IP : 216.73.216.133 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files/LibreOffice/help/en-US/text/shared/02/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Database Form Events</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for all modules" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<a name="events"></a>
<a name="bm_id3150499"></a><meta itemprop="keywords" content="forms, events">
<meta itemprop="keywords" content="events,in database forms">
<meta itemprop="keywords" content="forms,database events">
<h1 id="hd_id3150499" dir="auto">Database Form Events</h1>
<p id="par_id3147043" class="paragraph" dir="auto">The<span class="emph"> Events </span>tab page, allows you to assign a macro to certain events which occur in a database form.</p>
<a name="howtoget"></a><div class="howtoget">
<div><p class="howtogetheader" dir="auto"><a name="wie"></a>To access this command...</p></div>
<div class="howtogetbody">
<div class="embedded">
<a name="form_properties_events"></a>
<p id="par_id3145364" class="paragraph" dir="auto">Open context menu of a selected form element - choose <span class="menuitem">Form Properties - Events</span> tab.</p>
<p id="par_id3153575" class="paragraph" dir="auto">Open <span class="widget">Form Design</span> toolbar, click <span class="widget">Form Properties</span> icon - <span class="widget">Events</span> tab.</p>
</div>
</div>
</div>
<br>
<p id="par_id3159233" class="paragraph" dir="auto">To link an event with a macro, first write a macro that contains all the commands to be executed when the event happens. Then assign this macro to the respective event by clicking the <span class="emph">... </span>button beside the corresponding event. The<span class="emph"> Assign Macro </span>dialog opens, where you can select the macro.</p>
<p id="par_id3149182" class="paragraph" dir="auto">The following actions can be configured individually, meaning that you can use your own dialogs to depict an action:</p>
<ol itemprop="HowTo" itemscope="true" itemtype="http://schema.org/HowToSection" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/HowToStep" dir="auto">
<p id="par_id3166460" class="listitem" dir="auto">Displaying an error message,</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/HowToStep" dir="auto">
<p id="par_id3152996" class="listitem" dir="auto">Confirming a delete process (for data records),</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/HowToStep" dir="auto">
<p id="par_id3153541" class="listitem" dir="auto">Querying parameters,</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/HowToStep" dir="auto">
<p id="par_id3155261" class="listitem" dir="auto">Checking input when saving a data record.</p>
</li>
</ol>
<p id="par_id3153127" class="paragraph" dir="auto">For example, you can issue a "confirm deletion" request such as "Really delete customer xyz?" when deleting a data record.</p>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id0409200920562590" dir="auto">The events that are shown in the Events dialog cannot be edited directly. You can remove an event from the list by pressing the Del key.</p></div>
</div>
<br>
<p id="par_id3150986" class="paragraph" dir="auto">The following lists and describes all events in a form that can be linked to a macro:</p>
<a name="Section5"></a>
<a name="bm_id3150685"></a>
<a name="bm_id361601071200031"></a>
<meta itemprop="keywords" content="API,XRowSetListener">
<h2 id="hd_id3145749" dir="auto">After record action</h2>
<p id="par_id3146975" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> After record action </span>event occurs directly after the current record has been changed.</span></p>
<a name="Section3"></a>
<a name="bm_id3150420"></a>
<h2 id="hd_id3157975" dir="auto">After record change</h2>
<p id="par_id3154098" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> After record change </span>event occurs directly after the current record pointer has been changed.</span></p>
<a name="Section6"></a>
<a name="bm_id3151351"></a>
<a name="bm_id411600961384949"></a>
<meta itemprop="keywords" content="API,XRowSetApproveListener">
<h2 id="hd_id3149481" dir="auto">Before record action</h2>
<p id="par_id3156007" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Before record action </span>event occurs before the current record or record set are changed.</span> Return <span class="literal">True</span> when changing is allowed, otherwise <span class="literal">False</span>. For example, the linked macro can request confirmation in a dialog.</p>
<a name="Section4"></a>
<a name="bm_id3155413"></a>
<h2 id="hd_id3154012" dir="auto">Before record change</h2>
<p id="par_id3149664" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Before record change </span>event occurs before the current record pointer - SQL cursor - is changed.</span> Return <span class="literal">True</span> when moving is allowed, otherwise <span class="literal">False</span>.</p>
<a name="Section11"></a>
<a name="bm_id3157320"></a>
<h2 id="hd_id3148451" dir="auto">Before reloading</h2>
<p id="par_id3154218" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Before reloading </span>event occurs before the form is reloaded.</span> The data content has not yet been refreshed.</p>
<a name="Section13"></a>
<a name="bm_id3147084"></a>
<a name="bm_id361600961200031"></a>
<meta itemprop="keywords" content="API,XSubmitListener">
<meta itemprop="keywords" content="API,XSubmissionVetoListener">
<h2 id="hd_id3150870" dir="auto">Before submitting</h2>
<p id="par_id3159152" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Before submitting</span> event occurs before the form data is sent.</span> Returning <span class="literal">True</span> approves the submission, <span class="literal">False</span> stops it.</p>
<a name="Section9"></a>
<a name="bm_id3151116"></a>
<h2 id="hd_id3152792" dir="auto">Before unloading</h2>
<p id="par_id3152598" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Before unloading </span>event occurs before the form is unloaded; that is, separated from its data source.</span></p>
<a name="reset_update"></a>
<a name="bm_id3154072"></a>
<a name="bm_id311600955182139"></a>
<meta itemprop="keywords" content="API,XUpdateListener">
<h2 id="hd_id3147559" dir="auto">Before update</h2>
<p id="par_id3149669" class="paragraph" dir="auto"><span class="avis">The <span class="emph">Before update</span> event occurs before the control content changed by the user is written into the data source.</span> The linked macro can, for example, prevent this action by returning <span class="literal">FALSE</span>.</p>
<a name="bm_id3154073"></a>
<h2 id="hd_id3153779" dir="auto">After update</h2>
<p id="par_id3153360" class="paragraph" dir="auto"><span class="avis">The <span class="emph">After update</span> event occurs after the control content changed by the user has been written into the data source.</span></p>
<a name="bm_id3154851"></a>
<a name="bm_id601600955240219"></a>
<meta itemprop="keywords" content="API,XResetListener">
<h2 id="hd_id3157909" dir="auto">Prior to reset</h2>
<p id="par_id3155390" class="paragraph" dir="auto"><span class="avis">The <span class="emph">Prior to reset</span> event occurs before a form is reset.</span> Returning <span class="literal">True</span> approves the reset, returning <span class="literal">False</span> cancels the operation.</p>
<p id="par_id3149236" class="paragraph" dir="auto">A form is reset if one of the following conditions is met:</p>
<ol itemprop="HowTo" itemscope="true" itemtype="http://schema.org/HowToSection" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/HowToStep" dir="auto">
<p id="par_id3149164" class="listitem" dir="auto">The user presses an (HTML) button that is defined as a reset button.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/HowToStep" dir="auto">
<p id="par_id3153666" class="listitem" dir="auto">A new and empty record is created in a form that is linked to a data source. For example, in the last record, the <span class="emph">Next Record</span> button may be pressed.</p>
</li>
</ol>
<a name="bm_id3152473"></a>
<h2 id="hd_id3156119" dir="auto">After resetting</h2>
<p id="par_id3148563" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> After resetting </span>event occurs after a form has been reset.</span></p>
<a name="Section7"></a>
<a name="bm_id3154127"></a>
<a name="bm_id351600961291078"></a>
<meta itemprop="keywords" content="API,XConfirmDeleteListener">
<h2 id="hd_id3147426" dir="auto">Confirm deletion</h2>
<p id="par_id3154988" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Confirm deletion </span>event occurs as soon as data has been deleted from the form.</span> Return <span class="literal">True</span> to allow row deletion, <span class="literal">False</span> otherwise. For example, the linked macro can request confirmation in a dialog.</p>
<a name="Section1"></a>
<a name="bm_id3148387"></a>
<a name="bm_id372700961200031"></a>
<meta itemprop="keywords" content="API,XSQLErrorListener">
<h2 id="hd_id3146926" dir="auto">Error occurred</h2>
<p id="par_id3149485" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Error occurred </span>event is activated if an error occurs when accessing the data source.</span> This applies to forms, list boxes and combo boxes.</p>
<a name="Section2"></a>
<a name="bm_id3149298"></a>
<a name="bm_id881600961491605"></a>
<meta itemprop="keywords" content="API,XDatabaseParameterListener">
<h2 id="hd_id3151076" dir="auto">Fill parameters</h2>
<p id="par_id3147396" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> Fill parameters </span>event occurs when the form to be loaded has parameters that must be filled out.</span> For example, the data source of the form can be the following SQL command:</p>
<p id="par_id3148773" class="paragraph" dir="auto"><span class="literal">SELECT * FROM address WHERE name=:name</span></p>
<p id="par_id3149581" class="paragraph" dir="auto">Here :name is a parameter that must be filled out when loading. The parameter is automatically filled out from the parent form if possible. If the parameter cannot be filled out, this event is called and a linked macro can fill out the parameter. Return <span class="literal">True</span> when the execution of the parametrized statement should continue, <span class="literal">False</span> otherwise. </p>
<a name="Section12"></a>
<a name="bm_id3151383"></a>
<a name="bm_id472600961200142"></a>
<meta itemprop="keywords" content="API,XLoadListener">
<h2 id="hd_id3149167" dir="auto">When loading</h2>
<p id="par_id3156423" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> When loading </span>event occurs directly after the form has been loaded.</span></p>
<a name="Section10"></a>
<a name="bm_id3154946"></a>
<h2 id="hd_id3155102" dir="auto">When reloading</h2>
<p id="par_id3157895" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> When reloading </span>event occurs directly after the form has been reloaded.</span> The data content has already been refreshed.</p>
<a name="Section8"></a>
<a name="bm_id3152938"></a>
<h2 id="hd_id3154145" dir="auto">When unloading</h2>
<p id="par_id3154638" class="paragraph" dir="auto"><span class="avis">The<span class="emph"> When unloading </span>event occurs directly after the form has been unloaded; that is, separated from its data source.</span></p>
<h2 id="hd_id351601902633144" dir="auto">Vetoable events</h2>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id311600962806301" dir="auto">Macros can interrupt event execution when they return a boolean value: <span class="literal">True</span> allows the execution of the event to continue and <span class="literal">False</span> stops the event execution.</p></div>
</div>
<br>
<p id="par_id881601902428903" class="paragraph" dir="auto">The following events are interruptable by returning <span class="literal">False</span>:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="par_id441601902102235" class="listitem" dir="auto">Before record action</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="par_id51601902106123" class="listitem" dir="auto">Before record change</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="par_id451601902107636" class="listitem" dir="auto">Before submitting</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="par_id821601902108413" class="listitem" dir="auto">Before update</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="par_id81601902108958" class="listitem" dir="auto">Fill parameters</p></li>
</ul>
</div>
<div id="DonationFrame"></div>
<footer><div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/shared/02/01170202.xhp" target="_blank">/text/shared/02/01170202.xhp</a></p>
<p dir="auto">Title is: Database Form Events</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>