Mar 14, 2012, 1:40 PM
[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
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
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 ok2) 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]