Selective Validation

  1. #1

    Selective Validation

    How can I validate only certain fields in a form panel?
  2. #2

    RE: Selective Validation

    To validate only a field I use the following code
    Ext.getCmp('id_control').isValid()
    You can make a loop in all them field of the form and to only validate the ones that you want
    Ext.each(Ext.getCmp('id_formPanel').getForm().items.items, function(x) {
      if (!Ext.getCmp(x.id).isValid()) {
      
      }
    });
  3. #3

    RE: Selective Validation

    If you're using Coolite Toolkit controls, you do not require the call to Ext.getCmp. The following should work.

    Example


    TextField1.isValid();

    I'm assuming "TextField1" is the .ClientID of an <ext:TextField> control.


    Hope this helps.


    Geoffrey McGill
    Founder
  4. #4

    RE: Selective Validation

    Actually, I just set the formpanel to allow blank entries, and set the components that I didn't want to validate AllowBlank="true".

    This made the form only validate the entires that didn't have this property.



    <ext:FormPanel ID="BasicForm" runat="server" AutoWidth="true" Frame="true" AutoHeight="true" MonitorValid="true" BodyStyle="padding: 10px 10px 0 10px;">
    
    
    <Defaults>
    
    
    <ext:Parameter Name="anchor" Value="95%" Mode="Value" />
    
    
    <ext:Parameter Name="allowBlank" Value="true" Mode="Raw" />
    
    
    <ext:Parameter Name="msgTarget" Value="side" Mode="Value" />
    
    
    </Defaults>
    
    
    <Body>

Similar Threads

  1. Client Side Validation and Validation Status
    By speddi in forum 1.x Help
    Replies: 8
    Last Post: Nov 03, 2011, 11:24 AM
  2. Validation
    By Shubhangi in forum 1.x Help
    Replies: 0
    Last Post: Sep 20, 2011, 1:13 PM
  3. Validation again
    By AlexMaslakov in forum 1.x Help
    Replies: 4
    Last Post: Sep 20, 2011, 12:50 PM
  4. Replies: 3
    Last Post: Jul 11, 2011, 9:43 AM

Posting Permissions