You are here: Foswiki>Tasks Web>Item12445 (25 Mar 2013, GeorgeClark)Edit Attach

Item12445: Offer ability to specify displayed or stored values for +values fields

pencil
Priority: Enhancement
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: FORMFIELD, SEARCH
Branches:
Reported By: LynnwoodBrown
Waiting For:
Last Change By: GeorgeClark
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.

  • display returns $display

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
 

ItemTemplate edit

Summary Offer ability to specify displayed or stored values for +values fields
ReportedBy LynnwoodBrown
Codebase 1.1.8, trunk
SVN Range
AppliesTo Engine
Component FORMFIELD, SEARCH
Priority Enhancement
CurrentState Proposal Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r2 - 25 Mar 2013, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy