summaryrefslogtreecommitdiff
path: root/demos/currency-converter/protected/pages
diff options
context:
space:
mode:
authorwei <>2006-12-23 00:22:48 +0000
committerwei <>2006-12-23 00:22:48 +0000
commit6b685cc4e496c5eabbb3e6415fb7fdf0474bf0f1 (patch)
tree7a5859c07da28454b894a3ca003fede8880da4e4 /demos/currency-converter/protected/pages
parent2c221ea67d0512961beea8fbcb30b23865c16bb0 (diff)
add currency-converter tutorial
Diffstat (limited to 'demos/currency-converter/protected/pages')
-rw-r--r--demos/currency-converter/protected/pages/Home.page51
-rw-r--r--demos/currency-converter/protected/pages/Home.php15
2 files changed, 66 insertions, 0 deletions
diff --git a/demos/currency-converter/protected/pages/Home.page b/demos/currency-converter/protected/pages/Home.page
new file mode 100644
index 00000000..47b91344
--- /dev/null
+++ b/demos/currency-converter/protected/pages/Home.page
@@ -0,0 +1,51 @@
+<%@ Theme="Basic" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
+<com:THead Title="Currency Converter" />
+<body>
+<com:TForm>
+ <fieldset>
+ <legend>Currency Converter</legend>
+ <div class="rate-field">
+ <com:TLabel ForControl="currencyRate" Text="Exchange Rate per $1:" />
+ <com:TTextBox ID="currencyRate" />
+ <com:TRequiredFieldValidator
+ ControlToValidate="currencyRate"
+ Display="Dynamic"
+ ErrorMessage="Please enter a currency rate." />
+ <com:TCompareValidator
+ ControlToValidate="currencyRate"
+ DataType="Float"
+ ValueToCompare="0"
+ Operator="GreaterThan"
+ Display="Dynamic"
+ ErrorMessage="Please enter a positive currency rate." />
+ </div>
+ <div class="dollar-field">
+ <com:TLabel ForControl="dollars" Text="Dollars to Convert:" />
+ <com:TTextBox ID="dollars" />
+ <com:TRequiredFieldValidator
+ ControlToValidate="dollars"
+ Display="Dynamic"
+ ErrorMessage="Please enter the amount you wish to calculate." />
+ <com:TDataTypeValidator
+ ControlToValidate="dollars"
+ DataType="Float"
+ Display="Dynamic"
+ ErrorMessage="Please enter a number." />
+ </div>
+ <div class="total-field">
+ <span class="total-label">Amount in Other Currency:</span>
+ <com:TActiveLabel ID="total" CssClass="result" />
+ </div>
+ <div class="convert-button">
+ <com:TActiveButton Text="Convert" OnClick="convert_clicked" >
+ <prop:ClientSide.OnLoading>
+ $('<%= $this->total->ClientID %>').innerHTML = "calculating..."
+ </prop:ClientSide.OnLoading>
+ </com:TActiveButton>
+ </div>
+ </fieldset>
+</com:TForm>
+</body>
+</html> \ No newline at end of file
diff --git a/demos/currency-converter/protected/pages/Home.php b/demos/currency-converter/protected/pages/Home.php
new file mode 100644
index 00000000..dcf9339e
--- /dev/null
+++ b/demos/currency-converter/protected/pages/Home.php
@@ -0,0 +1,15 @@
+<?php
+Prado::using('System.Web.UI.ActiveControls.*');
+class Home extends TPage
+{
+ public function convert_clicked($sender, $param)
+ {
+ if($this->Page->IsValid)
+ {
+ $rate = floatval($this->currencyRate->Text);
+ $dollars = floatval($this->dollars->Text);
+ $this->total->Text = $rate * $dollars;
+ }
+ }
+}
+?> \ No newline at end of file