getValue problem in js

  1. #1

    getValue problem in js

       
    <ext:XScript ID="XScript1" runat="server">
            <script>
                 var IDVer = function()
                {
                    return #{TfFId}.getValue(); // Uncaught TypeError: Cannot call method 'getValue' of undefined 
                };
            </script>
        </ext:XScript>
                                     <ext:TextField ID="TfFId" Text="0" runat="server" Hidden="true" />
                                     <ext:GridPanel ID="GridPanel1" Region="Center" Flex="1" Height="250" runat="server">
                                            <LeftBar>
                                                <ext:Toolbar runat="server">
                                                    <Items>
                                                        <ext:Button runat="server" Icon="Add" Handler="#{Store1}.insert(0,new ModelStok());"/>
                                                    </Items>
                                                </ext:Toolbar>
                                            </LeftBar>
                                            <Store>
                                                <ext:Store ID="Store1" runat="server" OnBeforeStoreChanged="Kaydet">
                                                    <Model>
                                                        <ext:Model Name="ModelStok" IDProperty="Id" runat="server">
                                                            <Fields>
                                                                <ext:ModelField Name="Id" Type="Int" />
                                                                <ext:ModelField Name="StokId" Type="Int" />
                                                                <ext:ModelField Name="StokKodu" Type="String" />
                                                                <ext:ModelField Name="StokAdi" Type="String" />
                                                                <ext:ModelField Name="Miktar" Type="Int" />
                                                                <ext:ModelField Name="Fiyat" Type="Float" />
                                                            </Fields>
                                                        </ext:Model>
                                                    </Model>
                                                </ext:Store>
                                            </Store>
                                            <ColumnModel>
                                                <Columns>
                                                    <ext:RowNumbererColumn runat="server" />
                                                    <ext:Column runat="server" Text="Stok Kodu" MinWidth="80" DataIndex="StokKodu" />
                                                    <ext:Column runat="server" Text="Stok Adı" DataIndex="StokAdi" Width="570">
                                                        <Editor>
                                                            <ext:ComboBox runat="server" DisplayField="Adi" ValueField="Adi" TypeAhead="false"  PageSize="10" HideBaseTrigger="true" MinChars="1">
                                                                <ListConfig LoadingText="Aranıyor...">
                                                                    <ItemTpl ID="ItemTpl1" runat="server">
                                                                        <Html>
                                                                            <div class="search-item">
    							                                                <h3><span>{Fiyati}</span>{Adi}</h3>
    							                                                {Kodu}
    						                                                </div>
                                                                        </Html>
                                                                    </ItemTpl>
                                                                </ListConfig>
                                                                <Store>
                                                                    <ext:Store ID="Store2" runat="server" AutoLoad="false">
                                                                        <Proxy>
                                                                            <ext:AjaxProxy Url="HStok.ashx">
                                                                                <ActionMethods Read="POST" />
                                                                                <ExtraParams>
                                                                                    <ext:Parameter Name="ID" Value="IDVer()" Mode="Raw" />
                                                                                </ExtraParams>
                                                                                <Reader>
                                                                                    <ext:JsonReader Root="plants" TotalProperty="total" />
                                                                                </Reader>
                                                                            </ext:AjaxProxy>
                                                                        </Proxy>
                                                                        <Model>
                                                                            <ext:Model runat="server">
                                                                                <Fields>
                                                                                    <ext:ModelField Name="Adi" />
                                                                                    <ext:ModelField Name="Kodu" />
                                                                                    <ext:ModelField Name="Fiyati" Type="Float" />
                                                                                </Fields>
                                                                            </ext:Model>
                                                                        </Model>
                                                                    </ext:Store>
                                                                </Store>
                                                            </ext:ComboBox>
                                                        </Editor>
                                                    </ext:Column>
                                                    <ext:Column runat="server" DataIndex="Miktar" Width="60" Text="Miktarı">
                                                        <EditorOptions AutoSize="true" />
                                                        <Editor>
                                                            <ext:NumberField runat="server" AllowBlank="false" MinValue="1" />
                                                        </Editor>
                                                    </ext:Column>
                                                    <ext:Column runat="server" Text="Fiyatı" DataIndex="Fiyat" Width="60" Align="Right" />
                                            </ColumnModel>
                                            <Plugins>
                                                <ext:CellEditing runat="server" ClicksToEdit="1"/>
                                            </Plugins>
                                         </ext:GridPanel>
    fifth row, I get the error Uncaught TypeError: Cannot call method 'getValue' of undefined

    if calling the js function from button error does not.

    How send Textfield value parameter to *.ashx file in AjaxProxy.

    Thank you.


    -Hakan Ertuğ
  2. #2
    Hello!

    Couldn't reproduce, tried the following example:

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
       
        <ext:XScript ID="XScript1" runat="server">
            <script>
                var IDVer = function()
                {
                    return #{TfFId}.getValue(); // Uncaught TypeError: Cannot call method 'getValue' of undefined 
                };
            </script>
        </ext:XScript>
        
        <ext:TextField ID="TfFId" Text="0" runat="server" Hidden="true" />
                                     
        <ext:Button runat="server" Handler="alert(IDVer());" Text="Click me"></ext:Button>
    </body>
    </html>
    Also, instead of TextField you can use HiddenField if you are not going to show it.

    Moved to 2.x Help forum

Similar Threads

  1. [CLOSED] App.txtUserName.getValue()
    By imaa in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 23, 2013, 9:26 AM
  2. [CLOSED] Combobox getValue
    By jthompson in forum 1.x Legacy Premium Help
    Replies: 25
    Last Post: Jun 15, 2012, 11:14 AM
  3. [CLOSED] TextField.getValue()
    By supera in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 24, 2012, 1:17 PM
  4. Format datefield getValue
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Oct 21, 2011, 1:23 AM
  5. #{Hidden1}.getValue() failing
    By Juls in forum 1.x Help
    Replies: 4
    Last Post: Mar 20, 2009, 3:40 PM

Tags for this Thread

Posting Permissions