cancel
Showing results for 
Search instead for 
Did you mean: 

htmlb:inputField always uses encode="TRUE"

Thilo
Explorer
0 Kudos
107

Hi,

I have a inputField using data binding. The model field contains "Česká republika", and this code

<htmlb:inputField id="InpSupl" value="//model/edit_wa.supplier" encode="FALSE"/>

Renders to

<input class="sapEdfTxtEnbl" size="60" maxlength="60" name="cont_INVEST_invest_edit_wa.supplier" id="cont_INVEST_InpSupl" value="&amp;#268;eská republika">

How can I prevent this HTML-encoding?

Version 6.40 SP 12.

Thanks,

Thilo

Accepted Solutions (0)

Answers (2)

Answers (2)

rainer_liebisch
Contributor
0 Kudos

Hi Thilo,

it seems you have a codepage problem. Please have a look at this thread:

Important is also the note mentioned there: 825036

Regards,

Rainer

athavanraja
Active Contributor
0 Kudos

set <htmlb:content forceEncode = "TRUE"

also check sbspext_htmlb/inputfield.bsp

Regards

Raja

Thilo
Explorer
0 Kudos

htmlb:content forceEncode is set to BACKWARDS_COMPATIBLE, but still no effect to inputField encode="FALSE".

In sbspext_htmlb/inputfield.bsp Test #10 both examples display the value HTML-encoded.

athavanraja
Active Contributor
0 Kudos

add type parameter to the inputfield. pass type = "STRING"

checked this in sample application htmlb_samples/inputfieldsample.htm and its working fine.

Regards

Raja

Thilo
Explorer
0 Kudos

Thanks for your answer, but I disagree with you.

<htmlb:inputField id="InpSupl" value="&#268;eská republika" type="STRING" encode="FALSE"/>

And inputField is still rendering to

<input class="sapEdfTxtEnbl" size="20" name="cont_INVEST_InpSupl" id="cont_INVEST_InpSupl" value="&amp;#268;eská republika">

athavanraja
Active Contributor
0 Kudos

sorry for not being clear earlier. you dont need the encoding.

try the following code. I tried and its working fine.

<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = " ">
    <htmlb:form>
<htmlb:inputField id="InpSupl" value="&#268;eská republika" type="STRING"></htmlb:inputField>
     
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Regards

Raja

Thilo
Explorer
0 Kudos

Hmm, I don't understand all this.

Look here, this is my complete output (sorry about that) of your example.

And you can see, the ampersand is encoded, but I want the letter È (a upper sized C with a ^ on top).

Why does it work at your place?

<html><head><title> </title><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" ><meta http-equiv="imagetoolbar" content="no"><script type="text/javascript" language="JavaScript" src="/sap/public/bsp/sap/htmlb/events.js"></script><script type="text/javascript" language="JavaScript" src="/sap/public/bsp/sap/htmlb/event_dictionary.js"></script><link id="urstyle" rel="stylesheet" type="text/css" href="https://answers.sap.com/sap/public/bc/ur/Design2002/themes/sap_tradeshow/ur/ur_ie6.css"><link rel="stylesheet" type="text/css" href="https://answers.sap.com/sap/public/bc/ur/Design2002/themes/sap_tradeshow/ur/ur_pop_ie6.css"><script type="text/javascript" language="JavaScript">var popup_emptydoc="/sap/public/bsp/sap/htmlb/domainRelaxOff.htm";var HTMLB_SECTION508 = false;</script><script type="text/javascript" language="JavaScript">var sapUrDomainRelaxing = {NONE:"NONE",MINIMAL:"MINIMAL",MAXIMAL:"MAXIMAL"};ur_system={doc:window.document ,mimepath:"/sap/public/bc/ur/Design2002/themes/sap_tradeshow/common/",stylepath:"/sap/public/bc/ur/Design2002/themes/sap_tradeshow/ur/",emptyhoverurl:"/sap/public/bc/ur/Design2002/themes/sap_tradeshow/common/emptyhover.html",is508:false,direction:"ltr",domainrelaxing:sapUrDomainRelaxing.NONE,browser_abbrev:"ie6",dateformat:1,firstdayofweek:0}</script><script type="text/javascript" language="JavaScript" src="/sap/public/bc/ur/Design2002/js/sapUrMapi_ie6.js"></script><script type="text/javascript" language="JavaScript" src="/sap/public/bc/ur/Design2002/js/popup_ie6.js"></script><script type="text/javascript" language="JavaScript" src="/sap/public/bc/ur/Design2002/js/languages/urMessageBundle_de.js"></script><script type="text/javascript" language="JavaScript" src="/sap/public/bsp/sap/htmlb/misc.js"></script></head><body class="urBdyStd" scroll="AUTO" style="margin-left:2;margin-right:2;margin-top:2;margin-bottom:2">
      <input disabled type="hidden" id="htmlb_first_form_id" name="htmlb_first_form_id" value="htmlb_form_1"><form id="htmlb_form_1" name="htmlb_form_1" method="POST" autocomplete="off"><input type="hidden" name="htmlbScrollX"><input type="hidden" name="htmlbScrollY"><input type="hidden" name="htmlbevt_ty"><input type="hidden" name="htmlbdoc_id" value=""><input type="hidden" name="htmlbevt_frm" id="htmlbevt_frm" value="htmlb_form_1"><input type="hidden" name="htmlbevt_oid"><input type="hidden" name="htmlbevt_id"><input type="hidden" name="htmlbevt_cnt"><input type="hidden" name="htmlbevt_par1"><input type="hidden" name="htmlbevt_par2"><input type="hidden" name="htmlbevt_par3"><input type="hidden" name="htmlbevt_par4"><input type="hidden" name="htmlbevt_par5"><input type="hidden" name="htmlbevt_par6"><input type="hidden" name="htmlbevt_par7"><input type="hidden" name="htmlbevt_par8"><input type="hidden" name="htmlbevt_par9"><input type="hidden" name="onInputProcessing" value="htmlb"><input type="hidden" name="htmlb_form_1_complete" id="htmlb_form_1_complete" code="OK"><input type="hidden" name="sap-htmlb-design" id="sap-htmlb-design" value="">
          <span id="InpSupl-r" class="urEdf2Whl"><input type="Text" class="urEdf2TxtEnbl" autocomplete="off" id="InpSupl" ct="InputField" name="InpSupl" st="" value="&amp;#268;eská republika" onblur="sapUrMapi_InputField_Blur('InpSupl',event)" onkeydown="sapUrMapi_InputField_keydown('InpSupl',event)" onkeyup="sapUrMapi_InputField_KeyUp('InpSupl',event)" onfocus="sapUrMapi_InputField_focus('InpSupl',event)"></span>
      </form>
  
<script language="JavaScript">
function sapArrErase(){if(typeof(sapUrMapi_PcTabSeq_Registry)=='undefined') return;sapUrMapi_PcTabSeq_Registry1=sapUrMapi_PcTabSeq_Registry;sapUrMapi_PcTabSeq_Registry=new Array();for(var p in sapUrMapi_PcTabSeq_Registry1){if(document.getElementById(p)!=null)sapUrMapi_PcTabSeq_Registry[p]=true;}}function sapOnResize(){sapArrErase();;}window.onresize=sapOnResize;window.attachEvent ('onload', sapOnResize);
</script><script language="JavaScript">sapUrMapi_initLinkStatus();</script><noscript><iframe style="position:absolute;top:0;left:0;width:100%;height:150%" src="?sap-bsp-exception=NO_JS"></iframe></noscript><script language="JavaScript">if(document.cookie==null||document.cookie.indexOf("sap-contextid")<0){location.assign("?sap-bsp-exception=NO_CK");}</script></body></html>

In my opinion the inputField always does a encode="TRUE" and I don't have a chance to set it to FALSE.

athavanraja
Active Contributor
0 Kudos

Sorry i couldnt read your long code.

sorry again the type should be "

BCD

" and not string.

here is the code . (you dont have to specify about the encode parameter).

<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = " ">
    <htmlb:form>
<htmlb:inputField id="InpSupl" value="&#268;eská republika" type="BCD"></htmlb:inputField>
              
     <%= inp_val %>         
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Regards

Raja

Thilo
Explorer
0 Kudos

The only result I got from setting type="BCD" (Binary Coded Decimal - shoudn’t bee the right thing for a string!) is a style="text-align:right;".

I think the problem is here, take a look at Method get_output_value in Class cl_htmlb_inputfield


  escapehtml = cl_http_utility=>escape_html( escapehtml ).

endmethod.

Why isn't it


  IF me->encode = 'TRUE'.
    escapehtml = cl_http_utility=>escape_html( escapehtml ).
  ENDIF.

endmethod.

Or why is the cl_http_utility=>escape_html escaping things like &#268; ?

So I still have the problem, that a user can input any Unicode-Character (which results in a &#nnn; in the Model-Field) but htmlb:inputField does not display the correct characters. (This is how is works if I don’t manipulate the automatically set . Setting the charset=UTF-8 does not work because all texts from DDIC (using for example german Umlaute ÄÖÜ) are displayed incorrect.