You are here: Foswiki>Tasks Web>Item13407 (03 Jun 2017, AdminUser)Edit Attach

Item13407: Exclamation Point Chrs removed when FORMFIELD{} is used

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component:
Branches:
Reported By: RaymondLutz
Waiting For:
Last Change By: BaseUserMapping_333
Strings from FORMFIELD{}'s are altered by removing embedded !'s, likely due to autolinking, but <noautolink>, <literal> etc do not stop the removal.

Demo in http://trunk.foswiki.org/Sandbox/TestGoogleIframe

-- RaymondLutz - 18 May 2015

I have a little bit more information about this. It appears to me that the stripping of '!'s occurs immediately as the field is inserted, so there is no chance any controls will have any effect. You can test this on any topic with a form attached. (I was hoping that I could use ENCODE to replace all "!" with "%21" which should work okay in this case as there are no other !'s in the string, but it is not a general solution.)

I have this segment on my test page:
---------------
The following sentence is contained in the Phone1 FORMFIELD: <br>
Original string: Test!Sentence!with!embedded!exclamation!points! <br>
<verbatim> %FORMFIELD{"Phone1"}%</verbatim> <br>
%FORMFIELD{"Phone1"}%

<verbatim>%ENCODE{"Test!Sentence!with!embedded!exclamation!points!" old="!" new="%21"}%</verbatim> <br>
%ENCODE{"Test!Sentence!with!embedded!exclamation!points!" old="!" new="%21"}%

<verbatim>%ENCODE{"%FORMFIELD{"Phone1"}%" old="!" new="%21"}%</verbatim> <br>
%ENCODE{"%FORMFIELD{"Phone1"}%" old="!" new="%21"}%
----------------
And here is the result:
----------------
The following sentence is contained in the Phone1 FORMFIELD: 
Original string: Test!Sentence!with!embedded!exclamation!points! 

 %FORMFIELD{"Phone1"}%


TestSentencewithembeddedexclamationpoints!

%ENCODE{"Test!Sentence!with!embedded!exclamation!points!" old="!" new="%21"}%


Test%21Sentence%21with%21embedded%21exclamation%21points%21

%ENCODE{"%FORMFIELD{"Phone1"}%" old="!" new="%21"}%


TestSentencewithembeddedexclamationpoints%21

----------------
As you can see, the form field Phone1 is stripped of the embedded !'s BEFORE ENCODE has a chance to work on it.
I also tried turning that "insideout", which works the same way.

%FORMFIELD{"Phone1" format="$percentENCODE{\"$value\" old=\"!\" new=\"%21\"}$percent" }%


TestSentencewithembeddedexclamationpoints%21

This means that the !'s are stripped VERY EARLY in the process and thus there is no way to ever do anything on the page to fix it.

--------------

There is one more thing that can be tried, to place the ENCODE inside the field. Thus, I assigned Phone2 to be 

%ENCODE{"Test!Sentence!with!embedded!exclamation!points!" old="!" new="%21"}%


Envoked with: 

%FORMFIELD{"Phone2"}%


TestSentencewithembeddedexclamationpoints%21

No change, which was expected.
Thus, there is currently no way to pass embedded !'s through form fields to topics.

--Ray Lutz


Set to No Action. This seems to not be a problem on Foswiki 2.x, per the above trunk.foswiki.org demo page. We are no longer maintaining Foswiki 1.x.

-- Main.AdminUser - 03 Jun 2017 - 04:13

ItemTemplate edit

Summary Exclamation Point Chrs removed when FORMFIELD{} is used
ReportedBy RaymondLutz
Codebase 1.1.9
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release02x01Checkins
Release02x00Checkins
Release01x01Checkins
Topic revision: r3 - 03 Jun 2017, AdminUser
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