[CLOSED] custom search get value of combobox

  1. #1

    [CLOSED] custom search get value of combobox

    Hi

    I am having problem retrieving value of selecteditem in combobox using customsearch method.

    I have looked at this example http://forums.ext.net/showthread.php?4642

    I do see the ID in the Label when selecting item. My Issue is when I click on a button calling AjaxEvent to save the record.

    When I look at value of Label1.Text it is set to empty string. I have also tried setting a <ext:Hidden> field with no luck.

    Do I need to do anything special when I call the AjaxEvent.

    Thanks
    Idriss
    Last edited by geoffrey.mcgill; Feb 20, 2011 at 4:01 PM.
  2. #2

    RE: [CLOSED] custom search get value of combobox

    Hi,

    Text of label is not submitted automatically, you need use ExtraParams of AjaxEvent to pass it to the server.
    HiddenField should automatically submit to the server


    Please demonstrate your code
  3. #3

    RE: [CLOSED] custom search get value of combobox

    
    
    
    
    <ext:Store ID="store1" runat="server" AutoLoad="false">
    
    
    <Proxy>
    
    
    <ext:HttpProxy Method="POST" Url="SearchHandler.ashx" />
    
    
    </Proxy>
    
    
    <Reader>
    
    
    <ext:JsonReader Root="contacts" TotalProperty="totalCount">
    
    
    <Fields>
    
    
    <ext:RecordField Name="ID" />
    
    
    <ext:RecordField Name="DisplayName"/>
    
    
    <ext:RecordField Name="Primary"/>
    
    
    <ext:RecordField Name="EntityID" />
    
    
    <ext:RecordField Name="Salutation" />
    
    
    <ext:RecordField Name="FirstName" />
    
    
    <ext:RecordField Name="LastName" />
    
    
    <ext:RecordField Name="Position" />
    
    
    <ext:RecordField Name="Phone" />
    
    
    <ext:RecordField Name="Email" />
    
    
    <ext:RecordField Name="Active" Type="Boolean" />
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    <BaseParams>
    
    
    <ext:Parameter Name="userID" Value="#{txtUserId}.getValue()" Mode="Raw" />
    
    
    </BaseParams>
    
    
    </ext:Store>
    
    
    
    <ext:Panel ID="Panel1" runat="server" Title=" " Header="false" BodyStyle="padding:6px;"
    
    
    BodyBorder="false" AutoHeight="true">
    
    
    <Body>
    
    
    <ext:FieldSet runat="server" CheckboxToggle="true" Title="User Information" AutoHeight="true"
    
    
    Collapsed="false">
    
    
    <Body>
    
    
    
    <ext:FormLayout ID="FormLayout3" runat="server">
    
    
    <ext:Anchor Horizontal="97%">
    
    
    <ext:Panel runat="server" ID="pnlSearch" Width="400" Header="false" Border="false">
    
    
    <Body>
    
    
    <div style="width: 400px;">
    
    
    <div class="x-box-tl">
    
    
    <div class="x-box-tr">
    
    
    <div class="x-box-tc">
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <div class="x-box-ml">
    
    
    <div class="x-box-mr">
    
    
    <div class="x-box-mc">
    
    
    <h3 style="margin-bottom: 5px;">
    
    
    Search for Contacts</h3>
    
    
    <ext:ComboBox ID="cboSearch" runat="server" StoreID="store1" DisplayField="DisplayName"
    
    
    ValueField="ID" TypeAhead="false" LoadingText="Searching..." Width="370" PageSize="20"
    
    
    HideTrigger="true" ItemSelector="div.search-item" MinChars="1">
    
    
    <Template ID="Template1" runat="server">
    
    
    <tpl for=".">
    
    
    <div class="search-item">
    
    
    <h3>{Position}{Primary} - {DisplayName}</h3>
    
    
    
    
    
    
    </tpl>
    
    
    </Template>
    
    
    
    </Body>
    
    
    </ext:FieldSet>
    
    
    <Listeners>
    
    
    <Select Handler="#{Label1}.setText(this.getValue());#{CID}.setValue(this.getValue());" />
    
    
    </Listeners>
    
    
    </ext:ComboBox>
    
    
    <div style="padding-top: 4px;">
    
    
    Contacts search (type '*' (asterisk) for showing all contacts for this user)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <div class="x-box-bl">
    
    
    <div class="x-box-br">
    
    
    <div class="x-box-bc">
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <ext:Label ID="Label1" runat="server" />
    
    
    <ext:Hidden runat="server" ID="CID">
    
    
    </ext:Hidden>
    
    
    </Body>
    
    
    </ext:Panel>
    
    
    </ext:Anchor>
    
    
    </ext:FormLayout>
    
    
    
    </Body>
    
    
    <Buttons>
    
    
    <ext:Button ID="btnSave" runat="server" Text="Save" Icon="Accept" CausesValidation="true">
    
    
    <Listeners>
    
    
    <Click Handler="
    
    
    if( !#{txtEmail}.validate() || !#{txtLastName}.validate() || !#{txtFirstName}.validate() || !#{chkGroupRoles}.validate() ) {
    
    
    Ext.Msg.alert('Error','An error has occured. please check your selections.');
    
    
    // return false to prevent the btnLogin_Click Ajax Click event from firing.
    
    
    return false; 
    
    
    }" />
    
    
    </Listeners>
    
    
    <AjaxEvents>
    
    
    <Click OnEvent="btnSave_Click">
    
    
    <EventMask ShowMask="true" Msg="Verifying..." MinDelay="500" />
    
    
    </Click>
    
    
    </AjaxEvents>
    
    
    </ext:Button>
    
    
    <ext:Button ID="btnCancel" runat="server" Text="Cancel" Icon="Decline">
    
    
    <Listeners>
    
    
    <Click Handler="parent.top.window.topwindow.hide();" />
    
    
    </Listeners>
    
    
    </ext:Button>
    
    
    </Buttons>
    
    
    </ext:Panel>
    
    
    
    protected void btnSave_Click(object sender, Coolite.Ext.Web.AjaxEventArgs e)
    
    
    {
        Debug(this.Label1.Text);  // ==> EMPTY
        Debug(this.CID.Value);    // ==> EMPTY
    }
  4. #4

    RE: [CLOSED] custom search get value of combobox

    Hi,

    Label1.Text empty - it is correct
    But hidden field should has a value


    Does the hidden field is placed inside ASP.NET form?


    Please demonstrate the full example which we can test
  5. #5

    RE: [CLOSED] custom search get value of combobox

    Vlad

    I have figured out what is happening. as I was preparing example for you, I did not include hidden field inside formlayout which is inside FieldSet. when I do that, it works, I can retrieve value in AjaxEvent so I am ok now.

    Thanks for your help
    idriss

Similar Threads

  1. [CLOSED] Custom Search Combobox
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 02, 2011, 1:40 PM
  2. custom search in combobox
    By aditya.murthy88@gmail.com in forum 1.x Help
    Replies: 0
    Last Post: Feb 05, 2011, 8:57 AM
  3. [CLOSED] Custom Search Combobox
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 04, 2010, 7:29 PM
  4. ComboBox Custom Search Example
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Aug 15, 2009, 10:59 PM
  5. ComboBox Custom Search example
    By echo in forum 1.x Help
    Replies: 1
    Last Post: Jul 01, 2009, 1:27 PM

Posting Permissions