[CLOSED] V2.0 Validation Form Help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] V2.0 Validation Form Help

    Hi, i need any help for validation the form and enabled button, this is the sample page:

    1)If tipy any word in the first field, the button save now enable, if the field is empty the button is disable and
    <ValidityChange Handler="App.ButtonSave.setDisabled(!valid);" />
    work ok

    2) Type any character in firts field and the button is enable,
    If type "validate" in the second field and blur, the error appear ok, but the form not validate the state of the button, is't enable and not disable..

    I can not disable the button, any solution is accepted



    tanks

    Aurelio

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ARWebRevolution.WebForm1" %>
    
    <%@ 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 id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
     
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
         
             <ext:Viewport ID="Viewport1" runat="server" Layout="border">
            <Items>           
                 <ext:FormPanel ID="FormPanelNazione" runat="server" ButtonAlign="Right" Height="185"
                    BodyPadding="10" Padding="3"  Region="Center" Title="Nazioni..." Layout="AutoLayout">    
                    <Items>
                     <ext:TextField ID="txtForCod" runat="server" Width="180" AllowBlank="false"
                                    BlankText="*Obbligatorio" MaxLength="8" MaxLengthText="*Lunghezza massima 8 caratteri."
                                    FieldLabel="Codice" >
                                    <ToolTips>
                                        <ext:ToolTip ID="ToolTipForCod" runat="server" Title="Codice" Html="Codice del fornitore" />
                                    </ToolTips>
                                </ext:TextField>
                                <ext:TextField ID="txtRagSoc" runat="server" AnchorHorizontal="100%" 
                                    MaxLength="16" MaxLengthText="*Lunghezza massima 16 caratteri."
                                    FieldLabel="Ragione sociale" >
                                    <Listeners>
                                        <Blur CausesValidation="true" Handler="test()" />
                                    </Listeners>
                                    <ToolTips>
                                        <ext:ToolTip ID="ToolTip1" runat="server" Title="Codice" Html="Ragione sociale" />
                                    </ToolTips>
                                </ext:TextField>
                    </Items>  
                      <BottomBar>
                                <ext:Toolbar runat="server" ID="ToolBarFornitore">
                                    <Items>
                                      
                                        <ext:Button ID="ButtonSave" runat="server" Text="Salva"  Scale="Medium"
                                             Icon="Disk" ToolTip="Salva le modifiche apportate"
                                            ToolTipType="Title" Disabled="true">
                                          
                                        </ext:Button>
                                                                       </Items>
                                </ext:Toolbar>
                            </BottomBar> 
                     <Listeners>
                                <ValidityChange Handler="App.ButtonSave.setDisabled(!valid);" />
                            </Listeners>              
                </ext:FormPanel>
            </Items>
        </ext:Viewport>     
        </form>
        <script type="text/javascript" >
    
            //Controllo Codice Fiscale
           
                function test () {
                    var cf = App.txtRagSoc.getValue();
                     if (cf == 'validate') {
                        App.txtRagSoc.markInvalid('Error');
                        return false;
                    }
                   
                    return true;
                };
          
        </script>
    </body>
    </html>
    Last edited by Daniil; Mar 14, 2012 at 3:08 PM. Reason: Please use [CODE] tags for all code, [CLOSED]
  2. #2
    Hi,

    The markInvalid method doesn't cause a field to be validated.

    Please use Validator.

    Example
    <ext:TextField ...>
        <Validator Fn="myValidator" />    
    </ext:TextField>
    See also
    http://docs.sencha.com/ext-js/4-0/#!...od-markInvalid
    http://docs.sencha.com/ext-js/4-0/#!...-cfg-validator
  3. #3
    HI, Daniil very very thanks..it's work ok

    Aurelio

Similar Threads

  1. [CLOSED] When using Form Validation, I get the error below:
    By Fahd in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 23, 2012, 3:51 PM
  2. Login form - validation form
    By LordMX in forum 1.x Help
    Replies: 0
    Last Post: Aug 14, 2011, 11:44 AM
  3. [CLOSED] RowEditor & Form Validation
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 22, 2011, 9:45 AM
  4. [CLOSED] validation form all
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 22, 2011, 8:05 PM
  5. [CLOSED] Form validation on Page_Load
    By CSG in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 08, 2009, 10:09 PM

Posting Permissions