Jun 14, 2012, 3:53 PM
[CLOSED] Remote Validation and Processing Time
Hello, I've implemented remote validation for one of the fields.
Anyway it still troubles me, because user is still able to perform a quick save click and avoid the validation. Tried with disabling the 'Save' button during the validation process, but if performed real quickly can be overridden as well :-(.
Here's the code:
Anyway it still troubles me, because user is still able to perform a quick save click and avoid the validation. Tried with disabling the 'Save' button during the validation process, but if performed real quickly can be overridden as well :-(.
Here's the code:
<ext:NumberField ID="nfTemplateID" runat="server" AllowDecimals="false" AllowNegative="false"
IsRemoteValidation="true" MaxLength="10" Width="120">
<RemoteValidation OnValidation="CheckField" />
<Listeners>
<BeforeRemoteValidation Handler="top.RibbonButton('save').disable()" />
<RemoteValidationValid Handler="top.RibbonButton('save').enable()" />
</Listeners>
</ext:NumberField>
Server method: Protected Sub CheckField(ByVal sender As Object, ByVal e As RemoteValidationEventArgs)
Dim field As NumberField = DirectCast(sender, NumberField)
Dim oReq As Requirement.Requirement
Dim ReqId As Integer
If Not field.Value Is Nothing Then
Try
ReqId = Convert.ToInt32(field.Value)
oReq = New Requirement.Requirement(ReqId)
If oReq Is Nothing OrElse oReq.ReqId = 0 Then
e.Success = False
e.ErrorMessage = "Requsition with the ID: " & ReqId & " does not exist!"
Else
e.Success = True
End If
Catch ex As ReqNotFoundException
e.Success = False
e.ErrorMessage = "Requsition with the ID: " & ReqId & " does not exist!"
End Try
Else
e.Success = True
End If
End Sub
Last edited by Daniil; Jun 20, 2012 at 10:55 AM.
Reason: [CLOSED]