Freemarker rendering differently on IE8

Posted by scphantm on Stack Overflow See other posts from Stack Overflow or by scphantm
Published on 2012-09-06T15:32:30Z Indexed on 2012/09/06 21:38 UTC
Read the original article Hit count: 147

Filed under:

we have a template that uses this for the record line

<input type="${inputType}" name="${variableName}.code" id="${variable}.${vnum}.${answer.code}" class="checkbox" value="${answer.code}"
             [#nested/] [#if (answer.textLength > 0) && scripting]onchange="showOtherBox( this, '${variable}.[#if descriptionHack]${variableNumber}[#else]${vnum}[/#if].${answer.code}.description' )"[/#if]
             [#if showValues && (existing == answer.code)]checked="checked"[/#if]/>

On IE8 it renders as this

<span class="field">
<INPUT id=responses.8.L class=checkbox value=L type=checkbox name="responses['8'].answers['L'].code"> 
<LABEL for=responses.8.L>Award(s) for special accomplishment or performance related to activity participation (please list)</LABEL> 
<TEXTAREA id=responses.8.L.description class=" visible" rows=4 cols=60 name="responses['8'].answers['L'].description"></TEXTAREA> 
</span>

and on every other browser we tried, it renders as this

<span class="field">
<input type="checkbox" name="responses['8'].answers['L'].code" id="responses.8.L" class="checkbox" value="L" onchange="showOtherBox( this, 'responses.8.L.description' )">
<label for="responses.8.L">Award(s) for special accomplishment or performance related to activity participation (please list)</label>
<textarea rows="4" cols="60" name="responses['8'].answers['L'].description" id="responses.8.L.description" class="visible" classname="visible"></textarea>
</span>

The difference being that in the FTL script, the if statement

[#if (answer.textLength > 0) && scripting]

is true for everything except IE. In IE8 its false for some reason and therefore it does not put the OnChange javascript event on the input tag. Has anyone seen anything like this before? we are using Freemarker 2.3.9

Update, it kinda works if i turn compatibility mode on for IE8. but not exactly. when i do that, the onchange event doesn't fire until the check box loses focus. which is very different than everything else. Is there a quick way to fix this without too much trouble? i suppose i could put something in that says if ie8, insert onclick instead of onchange. that may work, but i would need an authorization from the client to fix it like that.

© Stack Overflow or respective owner

Related posts about freemarker