<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font size="4">Hi folks, <br>
</font></p>
<p><font size="4">Here is a first example of form declarations and
validations:</font></p>
<table width="100%" cellspacing="2" cellpadding="2" border="1">
<tbody>
<tr>
<td valign="top"><img
src="cid:part1.qdxlv3bu.bL2zCdFh@free.fr" alt="form"
width="403" height="247"></td>
<td valign="top">
<pre> | mold panel |
mold := Mold new.
(mold stringField)
label: 'Firstname:';
on: #propertyValue of: ValueHolder new;
beRequired.
(mold stringField)
label: 'Lastname:';
on: #propertyValue of: ValueHolder new;
addCondition: [:input| input size >= 2]
labeled: [:input | 'There is no such short name.'];
beRequired: 'Lastname required.'.
(mold dateField )
label: 'Birth date:';
on: #propertyValue of: ValueHolder new;
beRequired.
panel := nil.
panel := PluggableDialogPanel
open: mold
label: 'Example One'
view: #renderForms
accept: [mold validate.
panel morphExtent: panel minimumExtent. "I don't like to do it manually"
mold isValid ifTrue: [
mold save.
panel delete] ]</pre>
</td>
</tr>
</tbody>
</table>
<p><font size="4"><br>
</font></p>
<p>It is in the Cuis-Smalltalk-UI repo, I also added a
PluggableDialogPanel.</p>
<p>One point I don't like, not related to the forms, is after each
form validation I have to manualy resize the Panel, because
depending on error message. See my comment in the code example.<br>
</p>
Hilaire <br>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</body>
</html>