[CLOSED] Error Message is not shown

  1. #1

    [CLOSED] Error Message is not shown

    Hi,

    With the following code snippet, when entering a value not qualified for MinValue, the validation is executed, border turns red but the error message is not shown

                               <ext:CompositeField ID="cf2" runat="server" FieldLabel="Composite" LabelWidth="140">
                                  <Items>
                                     <ext:DisplayField ID="df3" runat="server" Width="50" Text="Min">
                                     </ext:DisplayField>
                                     <ext:NumberField runat="server" Width="100" MinValue="5" HideLabel="true" FieldLabel="Min"
                                        ID="minAdvPurchase" AllowDecimals="false" AllowNegative="false">
                                     </ext:NumberField>
                                     <ext:DisplayField ID="df4" runat="server" Width="50" StyleSpec="text-align:right;"
                                        Text="Max">
                                     </ext:DisplayField>
                                     <ext:NumberField runat="server" Width="100" MinValue="5" FieldLabel="Max" ID="maxAdvPurchase"
                                        AllowDecimals="false" AllowNegative="false">
                                     </ext:NumberField>
                                  </Items>
                               </ext:CompositeField>
    Last edited by Daniil; Aug 15, 2011 at 4:03 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please set CombineErrors="false" for the CompositeField.
  3. #3
    But it causes another issue when doing a validation of the FormPanel ( containing the CompositeField ). It does not show error messages.
  4. #4
    Well, there is no such option to have field's and combined messages at the moment.

    But I can suggest a way to have both messages. But I'm not sure it will work in all cases, but it should.

    Please see the example.

    The key points are:

    1. CombineErrors="false" for the CompositeField;
    2. The BeforeRender listener of the CompositeFIeld.

    Example

    <%@ Page Language="C#" %>
    
    <%@ 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>Ext.Net Example</title>
    
        <script type="text/javascript">
            var onBeforeRender = function (cf) {
                cf.onRender = cf.onRender.createSequence(function () {
                    this.eachItem(function (field) {
                        field.markInvalid  = field.markInvalid.createSequence(this.onFieldMarkInvalid.createDelegate(this, [field], 0));
                        field.clearInvalid = field.clearInvalid.createSequence(this.onFieldClearInvalid.createDelegate(this, [field], 0));
                    });
                });
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:FormPanel runat="server" Width="400" >
                <Items>
                    <ext:CompositeField 
                        runat="server" 
                        FieldLabel="CompositeField" 
                        AnchorHorizontal="-20" 
                        MsgTarget="Side"
                        CombineErrors="false">
                        <Items>
                            <ext:TextField 
                                ID="TextField1" 
                                runat="server" 
                                AllowBlank="false" 
                                Flex="1" />
                            <ext:TextField 
                                ID="TextField2" 
                                runat="server" 
                                AllowBlank="false" 
                                Flex="1" />
                        </Items>
                        <Listeners>
                            <BeforeRender Fn="onBeforeRender" />
                        </Listeners>
                    </ext:CompositeField>
                </Items>
            </ext:FormPanel>
        </form>
    </body>
    </html>
  5. #5
    Hi,

    Thank you. My application has a lot of composite fields.
  6. #6
    And do you want to apply this change for all CompositeFields globally avoiding setting up BeforeRender for each one?

Similar Threads

  1. [CLOSED] ResourceManager without error message
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 02, 2010, 5:00 PM
  2. !Ext.IsAjaxRequest error message
    By vali1993 in forum 1.x Help
    Replies: 1
    Last Post: Feb 08, 2010, 6:07 PM
  3. [CLOSED] Error message using CommitFailed Listener?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 27, 2010, 2:47 PM
  4. Custom Error Message
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: Aug 09, 2009, 5:36 PM
  5. [CLOSED] avoid communcation error message box
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 04, 2009, 12:10 AM

Tags for this Thread

Posting Permissions