[CLOSED] Simple ComboBox

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Simple ComboBox

    What am I missing? All I needed was just a simple combobox that a user can select a pre-defined reason or type in a new one. I am receiving a JSON error when I press my submit button.

    <ext:ComboBox ID="ReasonComboBox" runat="server" FieldLabel="Reason" LabelWidth="45" IndicatorIcon="BulletRed" IndicatorTip="Required Field" ForceSelection="false" QueryMode="Local" EmptyText="Type in a reason or select from list ...">
       <Items>
          <ext:ListItem Text="Reason1" />
          <ext:ListItem Text="Reason2" />
       </Items>
       <Triggers>
          <ext:FieldTrigger Icon="Clear" Qtip="Clear Entry" />
       </Triggers>
       <Listeners>
          <TriggerClick Handler="this.clearValue(); #{SubmitButton}.setDisabled(true);" />
          <DirtyChange Handler="#{SubmitButton}.setDisabled((this.getRawValue().length == 0));" />
       </Listeners>
    </ext:ComboBox>
    In the behind code I was calling ReasonComboBox.Text to retrieve the value either typed or selected in the combobox.
    Last edited by Daniil; May 02, 2012 at 4:25 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Could you provide a full sample? I am unable to reproduce the problem with the following one.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Submit(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Submit", this.ComboBox1.Text).Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox 
                ID="ComboBox1" 
                runat="server" 
                FieldLabel="Reason" 
                LabelWidth="45"
                ForceSelection="false"
                EmptyText="Type in a reason or select from list ...">
                <Items>
                    <ext:ListItem Text="Reason1" />
                    <ext:ListItem Text="Reason2" />
                </Items>
            </ext:ComboBox>
            <ext:Button runat="server" Text="Submit" OnDirectClick="Submit" />
        </form>
    </body>
    </html>
    I am receiving a JSON error when I press my submit button.
    Do you mean a JavaScript error? Well, I can't say anything concrete, because I can't see that button.
  3. #3
    I was able to get your test case working just fine.

    I stripped down my code as much as possible and still get an error. The code below is actually called as a popup window.

    TestUserInactivate.aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestUserInactivate.aspx.cs"
        Inherits="WAM.Section_User.TestUserInactivate" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <body>
        <ext:FormPanel ID="UserInactivateForm" runat="server" BodyPadding="10" DefaultAnchor="100%"
            Border="false" Width="480" Layout="Form">
            <Items>
                <ext:ComboBox ID="ReasonComboBox" runat="server" FieldLabel="Reason" IndicatorIcon="BulletRed"
                    ForceSelection="false" IndicatorTip="Required Field" QueryMode="Local" EmptyText="Type in a reason or select from dropdown list ..."
                    LabelWidth="45">
                    <Items>
                        <ext:ListItem Text="Last login more than 2 years ago." />
                        <ext:ListItem Text="Account Creation and Last Login within days of each other." />
                    </Items>
                    <Triggers>
                        <ext:FieldTrigger Icon="Clear" Qtip="Clear entry" />
                    </Triggers>
                    <Listeners>
                        <TriggerClick Handler="this.clearValue(); #{SubmitButton}.setDisabled(true);" />
                        <DirtyChange Handler="#{SubmitButton}.setDisabled((this.getRawValue().length == 0));" />
                    </Listeners>
                </ext:ComboBox>
            </Items>
            <Listeners>
                <AfterRender Handler="var win = parentAutoLoadControl; 
                    size = this.getSize();
                    size.height += 34;
                    size.width += 12;
                    win.setSize(size);
                    win.center();" Delay="100" />
            </Listeners>
            <Buttons>
                <ext:Button ID="SubmitButton" runat="server" Text="Submit" Disabled="true" Icon="Accept" OnDirectClick="SubmitButton_Click" />
                <ext:Button ID="ClearButton" runat="server" Text="Cancel" Icon="Cancel">
                    <Listeners>
                        <Click Handler="var win = parentAutoLoadControl; win.hide();" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:FormPanel>
    </body>
    </html>
    TestUserInactivate.aspx.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    
    using Ext.Net;
    
    namespace WAM.Section_User
    {
        public partial class TestUserInactivate : System.Web.UI.Page
        {
            protected void SubmitButton_Click(object sender, DirectEventArgs e)
            {
                X.Msg.Alert("Submit", this.ReasonComboBox.Text).Show();
            }
        }
    }
  4. #4
    Please clarify the version is used for testing your test sample? Is it Ext.Net v2?
  5. #5
    Yes v2.0 Rev 3975
  6. #6
    Hi,

    FormPanel doesn't create a <form> HTML element in Ext.NET v2.

    So, please add a top level <form> on the page or set up
    <AutoEl Tag="form" />
    for the FormPanel.

    It fixes the problem.

    One note more.

    There is no FormLayout in v2.
    Layout="Form"
    Please use AnchorLayout, which is default one of FormPanel. It functions the same way as FormLayout does previously.
  7. #7
    Quote Originally Posted by Daniil View Post
    There is no FormLayout in v2.
    Layout="Form"
    Please use AnchorLayout, which is default one of FormPanel. It functions the same way as FormLayout does previously.
    It is returned.
    http://docs.sencha.com/ext-js/4-1/#!...container.Form
  8. #8
    Quote Originally Posted by Daniil View Post
    FormPanel doesn't create a <form> HTML element in Ext.NET v2.

    So, please add a top level <form> on the page or set up
    <AutoEl Tag="form" />
    for the FormPanel.

    It fixes the problem.
    I've just discovered that DirectEvent creates a <form> for its parent FormPanel automatically and your example should work without any additional things.

    We are investigating.
  9. #9
    Finally, please use
    <AutoEl Tag="form" />
    or
    <form runat="server">
    in WebForms.
  10. #10
    I think that is the most conversations I seen you have with yourself (4 in a row). I just got into work and will integrate your suggestions. Sorry to through a monkey wrench into something that seemed so simple.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Simple or not ?
    By sisa in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 20, 2011, 7:59 AM
  2. [CLOSED] Reminder in Simple Tasks
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 15, 2011, 10:42 AM
  3. Its simple but Need help
    By kutbinahar in forum 1.x Help
    Replies: 0
    Last Post: Mar 05, 2011, 8:00 PM
  4. [CLOSED] Simple Portal Example
    By mxp in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 02, 2009, 5:21 PM
  5. [CLOSED] Need simple GridPanel explanation/example
    By stevejebson in forum 1.x Help
    Replies: 5
    Last Post: Sep 10, 2008, 8:23 PM

Posting Permissions