[TYPO3-50-general] Validator: unique users
Julian Kleinhans
kleinhans at bergisch-media.de
Mon Feb 7 09:15:08 CET 2011
Hi Bastian,
thanks for your reply!
The Problem here is that i must use the flashMessageContainer.. then i
have some messages in the "form.errors" viewhelper and this one in the
flashMessageConatiner.. it was beatifull if i can add my own errors like
if ($this->userRepository->findOneByUsername($username) !== NULL) {
$this->error->add('myForm', 'username', 'Username already used');
$this->redirect(...);
}
<f:form.errors for="myForm">
<div class="error">
<strong>{error.propertyName}</strong>:
<f:for each="{error.errors}" as="errorDetail">
{errorDetail.message}
</f:for>
</div>
</f:form.errors>
greetz
julian
Am 06.02.11 18:53, schrieb Bastian Waidelich:
> Julian Kleinhans wrote:
>
> Hi Julian,
>
> to finally give you an answer...:
>
>
>> To create new users is no problem.. but, the problem is that i can
>> register many users with the same username. I need a check that the
>> username is unique.
>
> That is a missing feature still unfortunately, see [1]
>
> For now you can create a validator or check the existence in the
> controller like:
>
> if ($this->userRepository->findOneByUsername($username) !== NULL) {
> $this->flashMessageContainer->add('Username already used');
> $this->redirect(...);
> }
>
>
> makes me think of another nice Fluid widget that checks the availability
> of a unique property via ajax..
>
> Best,
> Bastian
>
>
> [1] http://forge.typo3.org/issues/9557
More information about the TYPO3-project-5_0-general
mailing list