PDA

View Full Version : Badly formed HTML in transform combo



quilleashm
19 Jun 2007, 1:14 AM
Hi all,

I am trying out the combo box field using the transform method to apply it to an existing select + options.

When I have an & in one of the display values the HTML that is being generated/inserted doesn't properly escape the the &.

The generate HTML from firebug. Note the & in "a & b" is not escaped properly. This is in the update function on line 3211 of ext-all-debug.js.



<div class="x-combo-list-item">(Please select...)</div>
<div class="x-combo-list-item">a & b</div>
<div class="x-combo-list-item">aaaxx</div>
<div class="x-combo-list-item">das</div>
<div class="x-combo-list-item">ddd</div>
<div class="x-combo-list-item">gfd</div>


The original code looks like this.



<select id="j_id39:ctrId" name="j_id39:ctrId" size="1">
<option value="">(Please select...)</option>
<option value="Country,5">a &amp; b</option>
<option value="Country,4">aaaxx</option>
<option value="Country,1">das</option>
<option value="Country,3">ddd</option>
<option value="Country,2">gfd</option>
</select>

<script type="text/javascript">Ext.onReady(function(){
var converted = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: "all",
transform: "j_id39:ctrId",
forceSelection: true,
resizable: true});
});
</script>


However when I copy it into my test.html file it does not reproduce (combo works fine). It only fails when running inside my web app page. I have no idea why this is. The code above is a cut-paste of the view source from my web app page.

I think this is a bug as the HTML that firebug shows looks wrong but I can't figure out why it happens in my web app but not in a simple html file. Something to do with the content type perhaps? My web app files are .xhtml rather than .html.

Follow up: I have debugged the .html (working) version and it does not hit the same line (3211) that the failing version does so it's taking a different code path for some reason...

Any more detail required then please ask.

Cheers.

Mike.