[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: creators_id required



Hi Yuri,

I'd put that test inside cfg.d/eprint_validate.pl, something like:

my $creators = $eprint->value( 'creators' ) || [];
foreach my $c ( @{$creators} )
{
     if( !EPrints::Utils::is_set( $c->{id} ) )
     {
         push @problems, your_own_error_message;
         last;
     }
}


Hope this helps you,
Seb.

On 27/06/12 14:20, Yuri wrote:
> I would like to force the user to enter the creators_id in the creators
> field. I can make the field required using the workflow, but it does not
> force the user to fill the id part (I use it for the email).
>
> creators_name and creators_given are checked by fields_validate.pl, but
> I'm unable to do the same check using creators_id, as you can see in the
> code below.
>
> Any idea on this?
>
> Il 27/06/2012 12:19, Yuri ha scritto:
>> Hi!
>>
>>     how to configure eprints to have creators_id required? I don't know
>> using workflow. Using fields_validate.pl, this is my code:
>>
>>                            if( $field->get_name eq "creators_id" )<-
>> still have to add the check on the value...
>>                            {
>>                                    push @problems,
>>                                            $session->html_phrase(
>> "validate:missing_email",
>>                                                    fieldname=>$fieldname );
>>                            }
>>
>>
>> this should always return a problem, but instead it does nothing.... Any
>> idea?
>> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
>> *** Archive: http://www.eprints.org/tech.php/
>> *** EPrints community wiki: http://wiki.eprints.org/
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/