[studs-user] How to implement validation?
Status: Beta
Brought to you by:
mojavelinux
|
From: Adriano B. <adr...@gm...> - 2005-07-03 02:52:40
|
Hello!
I'm doing some tests in Golflog sample application, and could not
implement a validation at the present moment.
I looked golflog\WEB-INF\classes\golflog\form\PlayerActionForm.php and
added the follow method:
=09function validate(&$mapping, &$request)
=09{
$messages =3D& new ActionMessages();
=09=09$message =3D& new ActionMessage('bonat.teste');
=09=09$messages->add(c('ActionMessages::GLOBAL_MESSAGE'), $message);
=09=09return $messages;
=09}
Yeah, this always produces an error in the validation process, is just
for tests.
The struts-config.xml part that is important for PlayerActionForm
validation was modified to this:
=09=09<action
=09=09=09path=3D"/EditPlayerSubmit"
=09=09=09type=3D"golflog.action.EditPlayerSubmitAction"
=09=09=09name=3D"playerForm"
scope=3D"request"
validate=3D"true"
input=3D"Player Editor"
=09=09>
<forward name=3D"next" path=3D"/ListPlayers.action" redirect=3D=
"true"/>
=09=09</action>
I think that value of the 'input' attribute is wrong, but this is the
unique value that go back to the player editor form, but the
ActionMessages are not printed.
Best regards,
-Adriano
|