Results 1 to 3 of 3

Thread: Help with auto suggest in Ext.form.ComboBox

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Vote Rating
    1297
      0  

    Default

    Maybe try to listen to beforeload event on the store to change the param.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      0  

    Default

    Thanks a lot, it worked with the beforeLoad Listener.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •