PDA

View Full Version : HTML value in Combo Box



MarcoB
14 Jan 2011, 4:28 AM
Hi everyone,

In my language (French) we use accents a lot so for instance the word été (summer) is stored in my database as étéeacute;

So I have this Combobox where the word is properly displayed in the dropdown list as été but if I select it it comes up as étéeacute; which of course, is unreadable.

This is the variable I use :

var ClBox = new Ext.form.ComboBox({
store: ClStore,
name: 'clnt',
displayField:'Cl_Lib',
value: Devis.get('Cl_Lib'),
valueField: 'Client',
listeners:{
select: function(combo, record, index) {
curr_client = record.get('Client');
CodeClient.setValue(curr_client);
SegBox.setValue('');
SegStore.baseParams = { requete: 'SEGDET', client: curr_client };
SegStore.load();
}
},
typeAhead: true,
editable: true,
forceSelection: true,
mode: 'local',
triggerAction: 'all',
listClass: 'x-combo-list-small',
lazyRender: true,
anchor:'95%'
});

The store is a standard JSON store:

var Client = Ext.data.Record.create([
{name: 'Client', type: 'string'},
{name: 'Cl_Lib', type: 'string'}
]);

var ClStore = new Ext.data.JsonStore({
storeId: 'ClStore',
url: 'clients.asp',
root: 'resultats',
fields: ['Client', 'Cl_Lib'],
sortInfo: {field: 'Cl_Lib', direction: 'ASC'}
});

My question: How do I tell the combo to display the word in the same way as I see it in the dropdown list?

More generally, I have problems with the way Ext handles HTML for example if I POST été Ext will post %C3%A9t%C3%A9 instead of &eacute;téeacute; Also the html editor will add <br> at the end of the edited field.

Thank you for your help.

MarcoB

Condor
14 Jan 2011, 4:53 AM
Why does your database contain HTML encoded strings?

A more common scenario is that the database contains Unicode or UTF-8 encoded strings and that all server-client communication is done in UTF-8 format.

MarcoB
14 Jan 2011, 8:08 AM
Hi Condor, glad you are dealing with this...

OK, start with an empty input field entered via html editor. I typed été which Ext posted as %C3%A9t%C3%A9

On server side I have a classic asp page which converts this as &eacute;téeacute; before storing it in an MS-ACCESS database (tables are in ACCESS 2000 format)

Then the same field is brought "as is" into the JSON store of the combo box and in the dropdown I see été (fine) but if I select it, the dropdown disappears as it should and I see &eacute;téeacute; (ugly!)

So, what do you suggest I should try?

Thanks

MarcoB