summaryrefslogtreecommitdiff
path: root/demos/helloworld
diff options
context:
space:
mode:
Diffstat (limited to 'demos/helloworld')
-rw-r--r--demos/helloworld/protected/pages/Home.page5
-rw-r--r--demos/helloworld/protected/pages/Home.php11
2 files changed, 13 insertions, 3 deletions
diff --git a/demos/helloworld/protected/pages/Home.page b/demos/helloworld/protected/pages/Home.page
index 97702e67..0a4a36b4 100644
--- a/demos/helloworld/protected/pages/Home.page
+++ b/demos/helloworld/protected/pages/Home.page
@@ -7,9 +7,10 @@
<body>
<com:TForm>
-
+<com:TCaptcha ID="Captcha" CaseSensitive="true" MaxTokenLength="5" />
+<com:TTextBox ID="Input" />
<com:TButton Text="Click me" OnClick="buttonClicked" />
-
+<com:TCaptchaValidator EnableClientScript="true" ControlToValidate="Input" CaptchaControl="Captcha" Text="invalid" />
</com:TForm>
</body>
diff --git a/demos/helloworld/protected/pages/Home.php b/demos/helloworld/protected/pages/Home.php
index 432c2ee7..9722a782 100644
--- a/demos/helloworld/protected/pages/Home.php
+++ b/demos/helloworld/protected/pages/Home.php
@@ -2,9 +2,18 @@
class Home extends TPage
{
+ public function onPreRender($param)
+ {
+ echo "token is |".$this->Captcha->Token."|";
+ }
+
public function buttonClicked($sender,$param)
{
- $sender->Text="Hello World!";
+ if($this->Captcha->validate($this->Input->Text))
+ $sender->Text="ok";
+ else
+ $sender->Text="no!";
+ $this->Captcha->regenerateToken();
}
}