https://dataflex.wiki/index.php?title=Set_Web_Property_with_a_Client-Side_event&feed=atom&action=historySet Web Property with a Client-Side event - Revision history2024-03-28T11:51:19ZRevision history for this page on the wikiMediaWiki 1.41.0https://dataflex.wiki/index.php?title=Set_Web_Property_with_a_Client-Side_event&diff=3286&oldid=prevHsymington: Changed from Web Programming to Web Applications category2020-04-08T13:15:37Z<p>Changed from Web Programming to Web Applications category</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 14:15, 8 April 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l48">Line 48:</td>
<td colspan="2" class="diff-lineno">Line 48:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> http://www.dataaccess.eu/</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> http://www.dataaccess.eu/</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Web <del style="font-weight: bold; text-decoration: none;">Programming</del>]]</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Web <ins style="font-weight: bold; text-decoration: none;">Applications</ins>]]</div></td></tr>
</table>Hsymingtonhttps://dataflex.wiki/index.php?title=Set_Web_Property_with_a_Client-Side_event&diff=3166&oldid=prevWil: Created page with " This is a topic based on a forum post (archiving it here so that it is easier to find back) [https://support.dataaccess.com/Forums/showthread.php?65621-Set-Web-Property-with..."2020-03-03T11:37:11Z<p>Created page with " This is a topic based on a forum post (archiving it here so that it is easier to find back) [https://support.dataaccess.com/Forums/showthread.php?65621-Set-Web-Property-with..."</p>
<p><b>New page</b></p><div><br />
This is a topic based on a forum post (archiving it here so that it is easier to find back)<br />
<br />
[https://support.dataaccess.com/Forums/showthread.php?65621-Set-Web-Property-with-Javascript Set Web Property with Javascript]<br />
<br />
Harm's example code:<br />
<br />
<source lang="dataflex"><br />
Object oMyForm is a cWebForm<br />
{ WebProperty=Client }<br />
Property Integer piFocusCount 0<br />
<br />
Set psClientOnFocus to "window.OnFocusIncrementCount"<br />
Set piColumnSpan to 12<br />
Set psLabel to "Counts focus:"<br />
<br />
End_Object<br />
<br />
Object oMyButton is a cWebButton<br />
Set piColumnSpan to 0<br />
Set psCaption to "button"<br />
<br />
Procedure OnClick<br />
Integer iCount<br />
<br />
WebGet piFocusCount of oMyForm to iCount<br />
<br />
Send ShowInfoBox (SFormat("Form was focussed %1 times!", iCount))<br />
End_Procedure<br />
End_Object<br />
</source><br />
<br />
And the OnFocusIncrementCount JavaScript implementation:<br />
<br />
<source lang="javascript"><br />
function OnFocusIncrementCount(oEvent){<br />
var oMyForm = oEvent.oSource;<br />
var iCount = oMyForm.get("piFocusCount");<br />
iCount++;<br />
oMyForm.set("piFocusCount", iCount);<br />
}<br />
</source><br />
<br />
With the psClient.. event handlers you can define your functions globally (like in the example above) or locally on the object or subclass. If the event is defined globally then this will refer to the object on which the function is defined (in this case window). But the event always gets an event object as parameter with several properties including the source object of the event (oSource). So in the example above oSource points to the JavaScript version of oMyForm. Web properties can be accessed directly, but better is to use the get and set functions. The set function will make the property synchronized (so that is value is sent to the server) and both functions can take care of type conversions. <br />
<br />
Harm Wibier<br />
Data Access Europe B.V.<br />
http://www.dataaccess.eu/<br />
<br />
[[Category:Web Programming]]</div>Wil