Handler javascript's Error

  1. #1

    Handler javascript's Error

    Hi,

    I have a problem with Click Handler. When I click in btnAcessar without selecting a value generates a javascript's error.

    Why does it happen?

    
    
    
    <asp:Content ID="Content1" ContentPlaceHolderID="CenterRegion" runat="server">
    
    
    <ext:Store ID="StoreS" runat="server" AutoLoad="true">
    
    
    <Reader>
    
    
    <ext:JsonReader ReaderID="Id">
    
    
    <Fields>
    
    
    <ext:RecordField Name="Id" Mapping="Id" />
    
    
    <ext:RecordField Name="Descricao" Mapping="Descricao" />
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    </ext:Store>
    
    
    <ext:FitLayout ID="FitLayout1" runat="server">
    
    
    <ext:Panel ID="pnlP" runat="server" Title="" BodyStyle="padding:10px 10px 10px 10px;"
    
    
    AutoScroll="true">
    
    
    <Body>
    
    
    <ext:Window ID="winS" runat="server" Closable="false" Resizable="false" AutoHeight="true"
    
    
    Icon="Lock" Title="Lde S" Draggable="true" Width="650" Modal="true"
    
    
    BodyStyle="padding:5px;" Shadow="None">
    
    
    <Body> 
    
    
    <ext:Panel ID="pnlS" runat="server" AutoHeight="true" Collapsible="false" FormGroup="true"
    
    
    BodyStyle="padding:10px;">
    
    
    <Body>
    
    
    <ext:FormLayout ID="frmLS" runat="server" LabelAlign="Top">
    
    
    <Anchors>
    
    
    <ext:Anchor Horizontal="100%">
    
    
    <ext:ComboBox ID="cmbS" runat="server" Editable="false" StoreID="StoreS"
    DisplayField="Descricao"  ValueField="Id" TypeAhead="true"
    
    
    Mode="Local" EmptyText="Selecione." AllowBlank="false"> 
    
    
    </ext:ComboBox>
    
    
    </ext:Anchor> 
    
    
    </Anchors>
    
    
    </ext:FormLayout>
    
    
    </Body>
    
    
    </ext:Panel>
    
    
    </Body>
    
    
    <Buttons>
    
    
    <ext:Button ID="btnAcessar" runat="server" Text="Acessar" Icon="Accept"> 
    
    
    <Listeners>
    
    
    <Click Handler="if(!#{cmbS}.validate()){Coolite.AjaxMethods.ShowValidateMessage(); return false;}" />
    
    
    </Listeners>
    
    
    <AjaxEvents>
    
    
    <Click OnEvent="btnAcessar_Click">
    
    
    <EventMask ShowMask="false" />
    
    
    </Click> 
    
    
    </AjaxEvents>
    
    
    </ext:Button>
    
    
    </Buttons>
    
    
    <Listeners>
    
    
    <Show Handler="#{cmbS}.focus();" Delay="50" />
    
    
    </Listeners>
    
    
    <KeyMap>
    
    
    <ext:KeyBinding>
    
    
    <Keys>
    
    
    <ext:Key Code="ENTER" />
    
    
    </Keys>
    
    
    <Listeners>
    
    
    <Event Handler="#{btnAcessar}.fireEvent('click');" />
    
    
    </Listeners>
    
    
    </ext:KeyBinding>
    
    
    </KeyMap>
    
    
    </ext:Window>
    
    
    </Body>
    
    
    </ext:Panel>
    
    
    </ext:FitLayout>
    
    
    </asp:Content>
    Thanks
  2. #2

    RE: Handler javascript's Error

    Hi!

    So, when you click on btnAcessar the handler in the <Listeners> (client-side event handler) is invoked and then the handler in the <AjaxEvents> (Ajax request to the server) is invoked. So, when you click on btnAcessar WITH selecting a value the method "validate()" returns false and the handler in the <Listeners> do nothing, on the other hand when you click on btnAcessar without selecting the method Coolite.AjaxMethods.ShowValidateMessage() is invoked. So, something is wrong with that method. Could I see the method's definition? It looks something like that:

    <script runat="server">
        [AjaxMethod]
        public void ShowValidateMessage()
        {
            X.Msg.Alert("Attention!", "Combobox is not valid!").Show();  
        }
    </script>
    And I'll try to help you.
  3. #3

    RE: Handler javascript's Error


    Hi Daniil,

    I copied the Page for other project and didn't copied the AjaxMethod ShowValidateMessage.

    Mistakes happen.


    Thank you.



  4. #4

    RE: Handler javascript's Error

    Nice to help you, Rafael.

Similar Threads

  1. [CLOSED] JavaScript error when RowSelect handler is fired
    By Daly_AF in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 16, 2012, 6:15 AM
  2. Replies: 4
    Last Post: Apr 04, 2011, 8:54 AM
  3. Replies: 5
    Last Post: Mar 21, 2011, 5:15 PM
  4. Replies: 2
    Last Post: Jul 16, 2010, 11:59 AM
  5. [CLOSED] Resource handler error
    By armadalabs in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 24, 2010, 4:26 PM

Posting Permissions