[CLOSED] RadioGroup and getting the value?=

  1. #1

    [CLOSED] RadioGroup and getting the value?=

    Hey,
    trying to get the selected value in a RadioGroup. Not working very well. I must be missing something.

    The problem is that if I have the Change listeners for each "radio" in the radioGroup it fires twice, once for each Radio. That wont do. If I place it in the RadioGroup (ie outside of the Radio:s) when Its not fired at all, or at least I dont see it.

    So, in this example the DirectMethod is fired twice (the order depends on what you clicked).

    <ext:RadioGroup runat="server" Vertical="true" Width="300">
        <Items>
            <ext:Radio ID="RadioActive" runat="server" BoxLabel="A" InputValue="0">
               <Listeners>
                   <Change Handler="Ext.net.DirectMethods.Show(0);" />
               </Listeners>
            </ext:Radio>
            <ext:Radio ID="RadioNext" runat="server" BoxLabel="B" InputValue="1">
               <Listeners>
                   <Change Handler="Ext.net.DirectMethods.Show(1);" />
               </Listeners>
            </ext:Radio>
        </Items>
    </ext:RadioGroup>
    This code I cant see working at all:

    <ext:RadioGroup runat="server" Vertical="true" Width="300">
        <Items>
            <ext:Radio ID="RadioActive" runat="server" BoxLabel="A" InputValue="0">
            </ext:Radio>
            <ext:Radio ID="RadioNext" runat="server" BoxLabel="B" InputValue="1">
            </ext:Radio>
        </Items>
         <Listeners>
               <Change Handler="Ext.net.DirectMethods.Show(this.getValue());" />
         </Listeners>
    </ext:RadioGroup>
    Any ideas? =)
    Last edited by Daniil; May 04, 2011 at 10:08 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Lets consider your samples.

    Quote Originally Posted by wagger View Post
    So, in this example the DirectMethod is fired twice (the order depends on what you clicked).

    <ext:RadioGroup runat="server" Vertical="true" Width="300">
        <Items>
            <ext:Radio ID="RadioActive" runat="server" BoxLabel="A" InputValue="0">
               <Listeners>
                   <Change Handler="Ext.net.DirectMethods.Show(0);" />
               </Listeners>
            </ext:Radio>
            <ext:Radio ID="RadioNext" runat="server" BoxLabel="B" InputValue="1">
               <Listeners>
                   <Change Handler="Ext.net.DirectMethods.Show(1);" />
               </Listeners>
            </ext:Radio>
        </Items>
    </ext:RadioGroup>
    Yes, DirectMethods fires twice because both radios states are changed when you click on one of them.

    Quote Originally Posted by wagger View Post
    This code I cant see working at all:

    <ext:RadioGroup runat="server" Vertical="true" Width="300">
        <Items>
            <ext:Radio ID="RadioActive" runat="server" BoxLabel="A" InputValue="0">
            </ext:Radio>
            <ext:Radio ID="RadioNext" runat="server" BoxLabel="B" InputValue="1">
            </ext:Radio>
        </Items>
         <Listeners>
               <Change Handler="Ext.net.DirectMethods.Show(this.getValue());" />
         </Listeners>
    </ext:RadioGroup>
    Any ideas? =)
    The following code
    Ext.net.DirectMethods.Show(this.getValue());
    causes recursion. You can see this error in, for example, IE Developer Tools or FF FireBug consoles.

    Parameters of DirectMethods are automatically encoded. this.getValue() ('this' refers RadioGroup) returns a Radio instance. A Radio instance is a complex object that consists reference on its parent. So, it causes recursion during encoding.

    Please use
    <Change Handler="Ext.net.DirectMethods.Show(checked.getRawValue());" />
  3. #3
    Thanks Daniil!

    My bad on the first part, of course a Check-event is fired twice. I blame the late night =)

    And thanks for the second point too, that seemed to solve it =)

Similar Threads

  1. [CLOSED] RadioGroup
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 04, 2012, 4:23 PM
  2. [CLOSED] radiogroup horizontal
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 12, 2011, 9:31 AM
  3. [CLOSED] [1.0] RadioGroup Help
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 12, 2011, 8:17 AM
  4. [CLOSED] [1.0] RadioGroup
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 08, 2010, 7:54 AM
  5. [CLOSED] RadioGroup needs help
    By jsemple in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 12, 2009, 11:51 AM

Tags for this Thread

Posting Permissions