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.
[EP-tech] limiting possible values of a field to those in lookup table
From: David Lewis <david.lewis AT utc.fr>
Date: Thu, 08 May 2008 20:05:52 +0200
| Threading: | • This Message → Re: [EP-tech] limiting possible values of a field to those in lookup table from tdb01r AT ecs.soton.ac.uk → Re: [EP-tech] limiting possible values of a field to those in lookup table from david.lewis AT utc.fr |
*** http://www.eprints.org/tech.php/id/%3C48234100.60703%40utc.fr%3E *** EPrints community wiki - http://wiki.eprints.org/ Hi, I'm wondering what's the best way to implement a "constrained ↵ keywords" field in EP3.0 I'm autocompleting on user input as follows: <field ref="utc_keywords_rameau" input_lookup_url="{$config{perl_url}}/users/lookup/simple_sql" input_lookup_params="table=utc_keywords_rameau&mode=prefix"/> 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? Thanks for ideas, David
Re: [EP-tech] limiting possible values of a field to those in lookup table
From: Tim Brody <tdb01r AT ecs.soton.ac.uk>
Date: Fri, 16 May 2008 07:18:44 +0100
| Threading: | ↑ [EP-tech] limiting possible values of a field to those in lookup table from david.lewis AT utc.fr • This Message |
*** http://www.eprints.org/tech.php/id/%3C482D2744.90302%40ecs.soton.ac.uk%3E *** EPrints community wiki - http://wiki.eprints.org/ David Lewis wrote: > *** http://www.eprints.org/tech.php/id/%3C48234100.60703%40utc.fr%3E > *** EPrints community wiki - http://wiki.eprints.org/ > > Hi, > > I'm wondering what's the best way to implement a "constrained > keywords" field in EP3.0 > > I'm autocompleting on user input as follows: > > <field ref="utc_keywords_rameau" > input_lookup_url="{$config{perl_url}}/users/lookup/simple_sql" > ↵ input_lookup_params="table=utc_keywords_rameau&mode=prefix"/> > > 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? 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. All the best, Tim.
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, DavidATTACHMENT: smime.p7s
[index] [options] [help]




