Item12445: Offer ability to specify displayed or stored values for +values fields
Priority: Enhancement
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Rendering of +value DataForm field values is not consistent or controllable.
Here's the currently exhibited behavior (with examples):
- FORMFIELD returns the stored value. Eg:
%FORMFIELD{"SeverityLevel" topic="Support.SecurityAlert-SlideShowPlugin-2011-0828"}%
returns "3".
- SEARCH
formfield()
returns the displayed value. Eg: %SEARCH{"SecurityAlert-SlideShowPlugin-2011-0828" scope="topic" web="Support" nonoise="on" format="$formfield(SeverityLevel)"}%
returns "3"
Of the two, the formatted search is probably the more problematic as there are times when it's important to return the actual stored value. Currently one would have to insert the
FORMFIELD macro within the search format to achieve this.
It would be nice if both kinds of field reference provided control over this. Possible solutions:
- For VarFORMFIELD, provide a new format token, perhaps "$displayed", to render the displayed value.
- For FormattedSearch, provide a new variation on
$formfield()
that allows specification which format to return. Possible new token syntax: $formfield(name, [value|displayed])
. (e.g. $formfield(name, value)
would return the stored value.
Bug or enhancement request? Seems like a bug to me since the behavior is currently unpredictable and (i would argue) not what one would expect in the case of
SEARCH.
--
LynnwoodBrown - 23 Mar 2013
I don't do a lot with Wiki Applications, but it sure seems to me that
%FORMFIELD
and
$formfield
should return consistent results. However for consistency, the
$format
tokens of
%FORMFIELD
could be used:
$formfield(name, token)
where token is one of the supported tokens in
%FORMFIELD
: (
value
,
name
,
title
,
form
)
And based upon this quick test, it looks like
%FORMFIELD
doesn't have any documented token to access the displayed value. So for consistency,
%FORMFIELD
also needs a
$display
token.
Unfortunately, this all seems to be working as documented, I'll mark it as an enhancement. And since $formfield() already has positional parameters, this probably needs some further discussion and a proposal.
FORMFIELD format documentation
format="..." Format string. =$value= expands to the field value, and =$name= expands to the field name, =$title= to the field title, =$form= to the name of the form the field is in. The standard format tokens are also expanded.
SEARCH formfield documentation
$formfield(name) The field value of a form field;
$formfield(name, 10) Form field value, "- " hyphenated every 10 characters
$formfield(name, 20, -<br />) Form field value, hyphenated every 20 characters with separator "-<br />"
$formfield(name,30,...) Form field value, shortened to 30 characters with trailing ellipsis.
Even this is confusing, What triggers shortening vs. hyphenation. The ellipsis, or the leading space, and how would the token be handled? A non-numeric 2nd parameter?
--
GeorgeClark - 25 Mar 2013