Item9203: Cannot use non-ascii characters in formfield formatting token

pencil
Priority: Enhancement
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: DBCachePlugin
Branches:
Reported By: WikiGuest
Waiting For:
Last Change By: AntonioTerceiro
Generally wiki applications for Non-English speaking audiences will include form field names with non-ascii characters, such as "Título" ("Title" in Portuguese). These form fields are stored with a ascii-only field name ("Ttulo" in our example), and a title that corresponds to the original field name ("Título" in the example).

Both the %FORMFIELD% macro and %SEARCH%'s $formfield(...) formatting token support that: if you look for "Título", they will actually lookup the field name "Ttulo".

But %DBQUERY%'s $formfield(...) doesn't do that, and it would be nice if it behaved consistent with the existing similar funcionality.

The proposed solution is the following one:

diff --git a/DBCachePlugin/lib/Foswiki/Plugins/DBCachePlugin/WebDB.pm b/DBCachePlugin/lib/Foswiki/Plugins/DBCachePlugin/WebDB.pm
index 1a3533b..d3bb164 100644
--- a/DBCachePlugin/lib/Foswiki/Plugins/DBCachePlugin/WebDB.pm
+++ b/DBCachePlugin/lib/Foswiki/Plugins/DBCachePlugin/WebDB.pm
@@ -259,7 +259,7 @@ sub getFormField {
   $form = $topicObj->fastget($form);
   return '' unless $form;
 
-  my $formfield = $form->fastget($theFormField) || '';
+  my $formfield = $form->fastget(Foswiki::Form::fieldTitle2FieldName($theFormField)) || '';
   return urlDecode($formfield);
 }
 

-- AntonioTerceiro - 25 Jun 2010

Makes sense. However instead of calling fieldTitle2FieldName - which is a non-official api - I'd prefer to copy&paste the three regexes in there over to the code.

-- MichaelDaum - 25 Jun 2010

done at r9180

-- AntonioTerceiro - 16 Sep 2010
 

ItemTemplate edit

Summary Cannot use non-ascii characters in formfield formatting token
ReportedBy WikiGuest
Codebase
SVN Range
AppliesTo Extension
Component DBCachePlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins DBCachePlugin:5c47974691fb
TargetRelease n/a
ReleasedIn n/a
Topic revision: r5 - 16 Sep 2010, AntonioTerceiro - This page was cached on 24 Nov 2020 - 09:19.

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