how to avoid the page going to server side when textbox with attribut AllowBlank="false" is empty

  1. #1

    how to avoid the page going to server side when textbox with attribut AllowBlank="false" is empty

    Hello,
    I have one textbox with attribute AllowBlank="false". if i dont put any value in that textbox and click on the add button it is going sever.
    how to avoid that id it should not go to server since it does not contain value. Same thing for MinLength="5".

    code is as follows...

    <ext:Panel ID="PanelColumnDetails" runat="server" Frame="true" Title="Column Details"
            AutoWidth="true" AutoScroll="true" Header="true" Border="false" Width="600" Height="1001">
            <Content>
                <table border="1" cellpadding="1" cellspacing="1">
                    <tr>
                        <td>
                            <ext:TextField ID="txtFirst" AllowBlank="false" MinLength="5" MaxLength="5" runat="server">
                            </ext:TextField>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <ext:Button ID="btnAdd" runat="server" Text="Add">
                                <DirectEvents>
                                    <Click OnEvent="btnAdd_Click" ViewStateMode="Enabled">
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                        </td>
                    </tr>
                </table>
            </Content>
        </ext:Panel>
    Thanks and Regards

    Harshad Jadhav
  2. #2
    Hi,

    Returning false either from a respective Listener or DirectEvent's Before handler stops DirectEvent.
  3. #3

    how to avoid the page going to server side when textbox with attribut AllowBlank="false" is emp

    hi danill,

    Can you tell me how to do that with above example.....

    Thanks and Regards
    harshad
  4. #4
    Hi,

    Example
    <ext:Button runat="server" Text="Add">
        <Listeners>
            <Click Handler="return txtFirst.isValid();"/>
        </Listeners>
        <DirectEvents>
            <Click OnEvent="btnAdd_Click" />
        </DirectEvents>
    </ext:Button>

Similar Threads

  1. TextBox wit AllowBlank="False" and VType
    By inaltec in forum 1.x Help
    Replies: 2
    Last Post: Jul 25, 2012, 4:42 PM
  2. [CLOSED] Hidden="true" behaves as Visible="false"
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: May 28, 2012, 3:17 PM
  3. [CLOSED] DropDownField with AllowBlank="false" issue
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 23, 2011, 11:56 AM
  4. Replies: 3
    Last Post: May 25, 2011, 9:50 AM
  5. Replies: 0
    Last Post: Jan 18, 2011, 3:53 AM

Posting Permissions