Tech List

[index] [prev] [next] [options] [help]
See the Mailing Lists Page for how to subscribe and unsubscribe.

eprints_tech messages

Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.

Re: [EP-tech] limiting possible values of a field to those in lookup table

From: David Lewis <david.lewis AT utc.fr>
Date: Tue, 20 May 2008 11:33:52 +0200


Threading: [EP-tech] limiting possible values of a field to those in lookup table from david.lewis AT utc.fr
      • This Message

This is a cryptographically signed message in MIME format.

David Lewis wrote:
>> However, I want to prevent users from entering anything OTHER than 
>> values proposed in the lookup table .. i.e. force them to choose from 
>> a finite list of accepted values.
>>
>> Anybody else been faced with this problem and found a neat way around 
it?

Tim Brody wrote:
> How large are the number of predefined keywords?
> 
> You could use a NamedSet (i.e. a "select" box). Or you could 
enforce 
> something during validation.
> 
> Without implementing your own bits of javascript you can't have a text 
> field that only allows certain words.

Thanks for that, Tim. For me right now it's a question of working out 
which bits of "official" Eprints javascript I might possibly dare to 
tweak without the risk of causing massive collateral damage!

One way to avoid modifying .js files would be to use a complex authority 
list with a block of xhtml that does a bit more than just changing the 
value of a text field. The autocompleter lets you use a 'block' 
attribute as well as a 'value' attribute, so I thought for starters I 
might try and include something along the lines of

<li id='for:block:relative:_xxxx'> zzzzzzzzzzzzzzzzzzz </li>

where zzzzzzzzzzzzzzzzzzz would be replaced by something to set the 
value attribute of _xxxx AND ALSO to set the READONLY attribute to true.

If this is feasible I might then think about changing the text field 
into something else, like a select box with the SELECTED value depending 
on the string entered, in which case zzzzzzzzzzzzzzzzzzz would no doubt 
become a lot longer and more unwieldy, but not a single line of 
javascript would have been harmed .. yes, well, this might be pure 
folly. I still have to determine whether I can make zzzzzzzzzzzzzzzzzzz 
generate a simple readonly attribute.

Best wishes,
David



ATTACHMENT: smime.p7s!


[index] [prev] [next] [options] [help]