[CLOSED] [3.2x] Error setting Checkbox Note property

  1. #1

    [CLOSED] [3.2x] Error setting Checkbox Note property

    When I try to set the Note on a Checkbox using javascript I get the following error:

    Uncaught TypeError: Cannot read property 'dom' of null
    Ext.net.FieldNote.setNote @ ext.axd?v=19368:6595
    Window2_ShowAndSetNote @ testboxlabel.aspx:12
    fire @ ext.axd?v=19368:11885doFireEvent @ ext.axd?v=19368:12422
    prototype.doFireEvent @ ext.axd?v=19368:33397
    fireEventArgs @ ext.axd?v=19368:12392
    fireEvent @ ext.axd?v=19368:12366
    Ext.define.fireHandler @ ext.axd?v=19368:109038
    Ext.define.onClick @ ext.axd?v=19368:109027
    fire @ ext.axd?v=19368:11885
    Ext.define.fire @ ext.axd?v=19368:18703
    Ext.define.publish @ ext.axd?v=19368:18679
    Ext.define.doDelegatedEvent @ ext.axd?v=19368:18729
    Ext.define.onDelegatedEvent @ ext.axd?v=19368:18716
    Ext.Function.ExtFunction.bind.method @ ext.axd?v=19368:4400
    It seems the problem is in the // @source core/form/Field.js file:
        
    setNote: function (t, encode) {        this.note = t;
    
    
            if (this.rendered) {
                this.noteEl.dom.innerHTML = encode !== false ? Ext.util.Format.htmlEncode(t) : t;
            }
        },
    Here is a test case for the problem:
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    
    <script runat="server">
    
    
    </script>
    <ext:XScript ID="StudentStatsDisplayScripts" runat="server">
            <script type="text/javascript">
    
    
                var Window2_ShowAndChangeLabel = function (sender) {
                    #{Window2}.show();
                    #{chkBox1}.setBoxLabel("Also causes an error...");
                }
    
    
                var Window2_ShowAndSetNote = function (sender) {
                    #{Window2}.show();
                    #{chkBox1}.setNote("Causes an error...");
                }
    
    
            </script>
    </ext:XScript>
    
    
    <html>
    <head runat="server">
        <title>setBoxLabel error- Ext.NET Examples</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server">
            </ext:ResourceManager>
    
    
            <p>
                <ext:Button
                    ID="Button1"
                    runat="server"
                    Text="Set BoxLabel">
                    <Listeners>
                        <Click Fn="Window2_ShowAndChangeLabel" />
                    </Listeners>
                </ext:Button>
                <ext:Button
                    ID="Button2"
                    runat="server"
                    Text="Set Note">
                    <Listeners>
                        <Click Fn="Window2_ShowAndSetNote" />
                    </Listeners>
                </ext:Button>
    
    
            </p>
    
    
    
    
            <ext:Window
                ID="Window2"
                runat="server"
                Icon="House"
                Title="Click Listener"
                Hidden="true"
                X="275"
                Y="150">
                <Items>
                    <ext:Checkbox runat="server" ID="chkBox1" BoxLabel="Inital Text"
                        Checked="true">
                    </ext:Checkbox>
    
    
                </Items>
            </ext:Window>
    
    
        </form>
    </body>
    </html>
    I am using a build of 3.2 that was downloaded from the repository on 8/17/2015. If that helps trace the issue.

    Regards
    Last edited by Daniil; Sep 11, 2015 at 12:27 PM. Reason: [CLOSED]
  2. #2
    Hi tnwheeler

    I think there might be an issue with the noteEl being null.

    I'm not sure what could be the problem but I can suggest a quick workaround while this is looked into.

    Try setting Note=" " on the CheckBox markup. I am running 3.1 and this workaround did the trick for me.
  3. #3
    Hello everybody,

    Yes, .setNote() cannot render a note element if it is not rendered initially.

    The best way would be defining some Note stub as @EnZo suggested.
  4. #4
    I figured that out and was able to get it working with the priming space. The problem is the designers do not want the note taking up space in their design when it is absolutely necessary.
  5. #5
    I am not sure what you mean. Please elaborate.

    taking up space in their design
    Do you mean a requirement to set Note=" " itself?

    Or you mean that an empty note increases size of rendered Checkbox? (That doesn't happen to me, though).
  6. #6
    My apologies. Daniil, you are correct the "empty" note is not initially shown and adding it suppresses the error. The visual clutter was in the design not the code. :(
  7. #7
    The visual clutter was in the design not the code. :(
    Please clarify do you mean the problem was (or still the problem) in something that is not directly related to Ext.NET?
  8. #8
    My apologies on being unclear. The issue we had with adding a blank note as a placeholder was not a problem with Ext.net.
  9. #9
    Thank you for clarifying!

    Would you mind us closing the thread?

Similar Threads

  1. Replies: 1
    Last Post: Aug 28, 2015, 12:19 PM
  2. [FIXED] [1.7] FileUploadField Note Property
    By ambruslaco in forum Bugs
    Replies: 6
    Last Post: Apr 29, 2013, 10:57 AM
  3. Replies: 7
    Last Post: Sep 20, 2010, 10:06 PM
  4. Replies: 3
    Last Post: Jul 08, 2010, 8:48 PM
  5. Replies: 0
    Last Post: May 08, 2010, 3:28 AM

Tags for this Thread

Posting Permissions