On Sat, May 06, 2000 at 07:45:38PM -0500, dave bryson wrote:
> Cool! Along these same lines, what about a way for template authors to
> specify required fields. Maybe some type of object in the context that
> could be used.
>
> Like this: <input type="text" name="$required("fname")">
> then Turbine could have a standard way of dealing with this.
I like the idea of putting an object in the context to generate magic
names. It might be nice to have something in there to genereate the names
for ActionEvents like 'name="$actionevent("doAdd")'
However, IMO knowledge of required fields goes in the M bit of MVC - i.e.
in the business object itself.
What I'm doing for this is using business objects with a validate method.
I pass in the RunData so it can add error messages, and validate returns
a boolean.
So then the code in my Actions goes something like:
MyObj obj = new MyObj();
data.getParameters().setProperties(obj);
if (obj.validate(data))
{
obj.save();
}
else
{
data.getParameters().add("template", "editobj.wm");
}
Sean
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]