PDA

View Full Version : [CLOSED] RemoteValidation with ExtraParams not work



trePjt
Apr 02, 2014, 3:30 AM
In following example I add a ExtraParams in RemoteValidation, but it makes the page cannot show.
It seems have some javascript error. Is it a bug or I do some thing wrong?
I have tried if I change the mode of ExtraParams to value then the page is shown, but not work for raw.



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void vali_txtName(object sender, RemoteValidationEventArgs e)
{
e.Success = false;
e.ErrorMessage = "invalid";
}

</script>

<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:TextField runat="server" ID="txtName" IsRemoteValidation="true" MaxLength="50" EnforceMaxLength="true" Text="Some text here">
<RemoteValidation OnValidation="vali_txtName">
<ExtraParams>
<ext:Parameter Name="Values" Value="#{txtName2}.getValue()" Mode="Raw" />
</ExtraParams>
</RemoteValidation>
</ext:TextField>

<ext:TextField runat="server" ID="txtName2" MaxLength="50" EnforceMaxLength="true" Text="Some text here" />
</form>
</body>
</html>

Daniil
Apr 02, 2014, 4:30 PM
Hi @trePjt,

The second TextFied is not rendered by the time the RemoteValidation section is being built in JavaScript.

You can use the following instead of the ExtraParams section.

<RemoteValidation OnValidation="vali_txtName" Before="o.extraParams.Values = #{txtName2}.getValue();">

trePjt
Apr 03, 2014, 1:26 AM
It's work. Thank you.