This question about Topic Markup Language and applications: Answered

How display different names for field names in DataForms

Hi, on the page DataForms, it is explained how to display "human-friendly" field names:
  • If you want the Field name to include embedded spaces, use the format [<nop>[FieldName][Descriptive human-friendly Field Name]].

I've tried that, but it either does not display the right thing, showing the squares, or other pages cannot retrieve data from the fields. What am I doing wrong? Is it a problem, when I call for %FORMFIELD{"FieldNameFoo"}% and the field is named [<nop>[FieldNameFoo][Descriptive human-friendly Field Name]] ?

Is it not possilbe to display something different from the field name? I actually want to rename my FieldName, but in that case I'd have to re-edit alle the topics that have ever used that form - which is a lot. I have found out that there are similar requests to this, and tere may be no solution, but please answer me just to make sure that there really is no answer to this, which would be very disappointing.

-- LieVen - 27 Apr 2015

I'm afraid that you've stumbled across a bug (and misleading docs) regarding control of field names (see the bug report). Bottom line is that the format [<nop>[FieldNameFoo][Descriptive human-friendly Field Name]] just doesn't work at all and even if you remove that <nop>, it will store DescriptivehumanfriendlyFieldName as the field name. frown, sad smile So to display that field value, you'd use %FORMFIELD{"DescriptivehumanfriendlyFieldName"}%.

The only work-around I know of currently to display a user-friendly title for the field is to use FlexFormPlugin.

A couple additional comments about your predicament:
  • Just to make sure you realize: you can set the field name to something like "My User Friendly Field Name" and it will be displayed that way when editing, even though the actual field name (which would be used for the FORMFIELD macro would be MyUserFriendlyFieldName.
  • Keep in mind that the implications of changing a field name are even worse than might imagine: the next time a topic using that form is edited, the value associated with the old field name will be lost. If I really, really do need to change a field name, I have used GlobalReplacePlugin to modify the search and replace the meta-data for that form field in all topics that use it. It does work but you have to be careful.

-- LynnwoodBrown - 27 Apr 2015

Thanks a lot. I think I won't do the replace thing, because I have close to a thousand topics, and I really don't wanna mess up those. Fortunately, my used Fieldnames are not so much user-unfriendly. It would just be a nice thing to change.

-- LieVen - 29 Apr 2015

 

QuestionForm edit

Subject Topic Markup Language and applications
Extension DataForms
Version Foswiki 1.1.9
Status Answered
Related Topics
Topic revision: r4 - 29 Apr 2015, LieVen - This page was cached on 28 Mar 2017 - 23:42.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License