Permalink
Fetching contributors…
Cannot retrieve contributors at this time
116 lines (106 sloc) 3.12 KB
<@controller
class="EXAMPLE\calc\pres\controller\CalculatorController"
@>
<style type="text/css">
.apf-calc-mod {
border: 1px solid gray;
background-color: #eeeeee;
width: 210px;
padding: 10px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.apf-calc-mod h3 {
font-size: 16px;
font-weight: bold;
}
.apf-calc-mod form input,
.apf-calc-mod form select {
border: 1px solid gray;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.apf-calc-mod form fieldset {
border: 0 none;
margin: 0;
padding: 0;
}
.apf-calc-mod form input {
width: 150px;
}
.apf-calc-mod form label:before {
display: inline-block;
height: 0;
width: 100%;
content: ' ';
}
.apf-calc-mod form label {
margin-right: 5px;
}
.apf-calc-mod form input[type=submit] {
margin: 0 0 0 28%;
}
.apf-calc-mod p.error {
color: red;
font-weight: bold;
}
.apf-calc-mod p.result {
color: green;
font-weight: bold;
}
.apf-calc-mod .apf-form-error {
border: 2px solid red;
}
</style>
<div class="apf-calc-mod">
<h3>APF module "calc"</h3>
<html:form name="Calc" method="post">
<fieldset>
<form:error>
<p class="error">You did something wrong!</p>
</form:error>
<form:success name="result">
<p class="result">The result of the calculation is: ${result}</p>
</form:success>
<label>Operand1:</label>
<form:text name="operand1" />
<form:listener control="operand1" validator="APF\tools\form\validator\NumberValidator">
<p class="error">Error: This input field contains wrong content!</p>
</form:listener>
<label>Operation:</label>
<form:select name="operation">
<select:option value="plus">+</select:option>
<select:option value="minus">-</select:option>
<select:option value="div">/</select:option>
<select:option value="multiply">*</select:option>
</form:select>
<label>Operand2:</label>
<form:text name="operand2" />
<form:listener control="operand2" validator="APF\tools\form\validator\NumberValidator">
<p class="error">Error: This input field contains wrong content!</p>
</form:listener>
<form:listener control="operand2" validator="EXAMPLE\calc\pres\validator\ZeroDivisionValidator">
<p class="error">Error: detected division by zero!</p>
</form:listener>
<form:addfilter
class="APF\tools\form\filter\FloatFilter"
button="calc"
control="operand1|operand2"
/>
<form:addvalidator
class="EXAMPLE\calc\pres\validator\ZeroDivisionValidator"
button="calc"
control="operand2"
type="special"
/>
<form:addvalidator
class="APF\tools\form\validator\NumberValidator"
button="calc"
control="operand1|operand2"
type="special"
/>
<form:button name="calc" value="Calculate" />
</fieldset>
</html:form>
</div>