1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
    abhishek4 is on a distinguished road

      0  

    Default Help with auto suggest in Ext.form.ComboBox

    Help with auto suggest in Ext.form.ComboBox


    Hi,


    We are using Ext.form.ComboBox with auto suggest feature where in we make the call yo backend when some test is entered in the text area. Our servers don't allow apostrophe "'" in the url request for for stopping cross -site script attacks.


    I want to escape all the apostrophe that we type in the text bos before sending it to the back-end. Can you please suggest if this can be done?


    The code that we are using is as below:
    var dataset = new Ext.data.Store({
    reader: new Ext.data.JsonReader({
    fields : fieldsValueArray,
    root: 'rows'
    }),
    proxy: new Ext.data.HttpProxy({
    url : urlLocal
    }),
    autoLoad : true,
    baseParams: {
    'optionIndex': optionIndex
    }
    });


    var combobox = new Ext.form.ComboBox({
    id: optionId,
    hideTrigger : true,
    store: dataset,
    editable: true,
    displayField:display_field_json,
    valueField:value_field_json,
    typeAhead: false,
    mode: 'remote',
    triggerAction: 'all',
    renderTo: reportId + '_' + optionIndex + '_ControlNugget_Div',
    selectOnFocus:true,
    value: actualValue,
    width:inputWidth,
    forceSelection: !disableAutoSuggest,
    minLength:minLength,
    minLengthText:mandatoryMessage,
    mutuallyExclusiveCompIds:mutuallyExclusiveCompIds,
    minChars : minChars,
    listeners:{
    'blur': disableComponent.createDelegate(this, [mutuallyExclusiveCompIds])
    }
    });


    if(!disableAutoSuggest && actualValue != "" && actualValue != undefined && actualValue != null)
    {
    dataset.load({
    params: {
    'query': actualValue
    },
    callback: function(rs) {
    var recordIndex = this.find(value_field_json, actualValue);
    if(recordIndex != -1){
    var displayText = this.getAt(recordIndex).data[display_field_json];
    if(displayText != null && displayText != undefined ){
    combobox.setRawValue(displayText);
    }
    }
    }
    });
    }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Maybe try to listen to beforeload event on the store to change the param.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
    abhishek4 is on a distinguished road

      0  

    Default


    Thanks a lot, it worked with the beforeLoad Listener.

Thread Participants: 1

Tags for this Thread