summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-06-02 19:49:27 +0000
committerctrlaltca@gmail.com <>2011-06-02 19:49:27 +0000
commitcb90a05700b7ca6b621420598ff232aa2285310c (patch)
treedd18eb5af82decff38d18ec26d67fee1c6a8659d /demos/quickstart/protected/pages/ActiveControls/Samples/TCallback
parent6394a6ffe3a9f3e4e698603b94503dc96f1e2652 (diff)
upported to trunk/ last doc changes, everything should be fine now
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples/TCallback')
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page57
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.php24
2 files changed, 81 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page
new file mode 100644
index 00000000..55ced11e
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.page
@@ -0,0 +1,57 @@
+<com:TContent ID="body">
+
+<h1>TCallback Samples</h1>
+
+<table class="sampletable">
+
+<tr><td class="samplenote">
+An active label text being set as the result of a callback:
+</td><td class="sampleaction">
+
+<com:TCallback ID="callback1" OnCallback="callback1_Requested" />
+<script type="text/javascript">
+ function do_callback1()
+ {
+ var request = <%= $this->callback1->ActiveControl->Javascript %>;
+ request.dispatch();
+ }
+</script>
+<div onclick="do_callback1()" style="background-color:red;border: 1px solid black">Click Me!</div>
+<br/><com:TActiveLabel Text="This is a label" ID="label1"
+/>
+
+<br/><com:TActiveButton
+ Text="reset example"
+ OnClick="buttonClicked"
+/>
+</td></tr>
+
+<tr><td class="samplenote">
+A TCallback with a 3-items array as parameter.
+The first parameter is defined in the onclick() attribute of the red div;
+The second parameter is defined in the body of the javascript function;
+The third parameter is taken from the textbox;
+</td><td class="sampleaction">
+
+<com:TCallback ID="callback2" OnCallback="callback2_Requested" />
+<script type="text/javascript">
+ function do_callback2(param1)
+ {
+ var request = <%= $this->callback2->ActiveControl->Javascript %>;
+ var param2 = 'value 2';
+ var param3 = $('<%= $this->txt1->ClientID %>').value;
+ request.setCallbackParameter({'Param1':param1, 'Param2':param2, 'Param3':param3});
+ request.dispatch();
+ }
+</script>
+TextBox for third parameter: <com:TTextBox ID="txt1" text="value 3"/>
+<div onclick="do_callback2('value 1')" style="background-color:red;border: 1px solid black">Click Me!</div>
+<br/>Parameter 1 is <com:TActiveLabel Text="" ID="labelParam1" />
+<br/>Parameter 2 is <com:TActiveLabel Text="" ID="labelParam2" />
+<br/>Parameter 3 is <com:TActiveLabel Text="" ID="labelParam3" />
+</td></tr>
+
+
+</table>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.php
new file mode 100644
index 00000000..e7f39967
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallback/Home.php
@@ -0,0 +1,24 @@
+<?php
+
+class Home extends TPage
+{
+ public function callback1_Requested($sender,$param)
+ {
+ $this->label1->Text="You clicked the div, didn't you?";
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ $this->label1->Text="This is a label";
+ }
+
+ public function callback2_Requested($sender,$param)
+ {
+ $parameters=$param->CallbackParameter;
+ $this->labelParam1->Text = THttpUtility::htmlEncode($parameters->Param1);
+ $this->labelParam2->Text = THttpUtility::htmlEncode($parameters->Param2);
+ $this->labelParam3->Text = THttpUtility::htmlEncode($parameters->Param3);
+ }
+}
+
+?> \ No newline at end of file