PDA

View Full Version : [CLOSED] Gather Prompt Text value



PascuV
Oct 29, 2018, 7:55 AM
Hi, I've got a prompt and I would like to gather Its text. Here is my code:



<%@ Page Title="Fabricacion Jhayber" Language="C#" AutoEventWireup="true" CodeBehind="CheckQR.aspx.cs" Inherits="Fabricacion.CheckQR" %>
<!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="FIchaMaquina" runat="server">
<title>

</title>
<script type="text/javascript">

</script>

</head>
<body>


<form id="formGeneral" runat="server">
<ext:ResourceManager ID="ResourceManagerExt" runat="server" IDMode="Explicit" />
<ext:Viewport runat="server">
<Items>
<ext:Panel runat="server" ID="p2">
<Items>
<ext:FieldSet runat="server" ID="fieldset2" Title="Faltas">
<Defaults>
<ext:Parameter Name="labelWidth" Value="35%" />
</Defaults>
<Items>
<ext:TextField Id="notafield" runat="server" Hidden="true" Text="30"/>
<ext:TextField Id="tareafield" runat="server" Hidden="true" Text="CORTADO"/>
<ext:PasswordField runat="server" Revealable="true" Id="codigo" Label="ContraseƱa" ClearIcon="true" Border="true" MarginSpec="0 0 0 0"/>
<ext:SpinnerField runat="server" Id="T37" Label="Talla 37" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T38" Label="Talla 38" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T39" Label="Talla 39" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T40" Label="Talla 40" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T41" Label="Talla 41" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T42" Label="Talla 42" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T43" Label="Talla 43" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T44" Label="Talla 44" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T45" Label="Talla 45" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T46" Label="Talla 46" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>
<ext:SpinnerField runat="server" Id="T47" Label="Talla 47" MinValue="0" MaxValue="200" StepValue="1"></ext:SpinnerField>

</Items>
</ext:FieldSet>
<ext:Container runat="server" Layout="HBoxLayout">
<Defaults>
<ext:Parameter Name="style" Value="margin: 1em" />
<ext:Parameter Name="flex" Value="1" Mode="Raw" />
<%-- Use the value 1 not string "1" --%>
</Defaults>
<Items>
<ext:Button
runat="server"
Text="Aceptar y Enviar"
UI="Action"
Scope="this"
ID="formToggleBtn">
<DirectEvents>
<Tap OnEvent="btnLogin_Click"></Tap>
</DirectEvents>
</ext:Button>
<ext:Button
runat="server"
Text="Cancelar"
UI="Action">

</ext:Button>
<ext:Button runat="server" Text="Prompt">
<Listeners>
<Tap Handler="Ext.Msg.prompt('Title', 'Message', function(buttonId, text) {
Ext.net.DirectMethods.Test(buttonId, text);
});" ></Tap>
</Listeners>
</ext:Button>
</Items>
</ext:Container>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</form>



</body>
</html>



[DirectMethod]
public void Test(string buttonId, string text)
{
X.Msg.Alert("DirectMethod", buttonId + "<br/>" + text).Show();
}

As you can see, I've tried to gather it following this (https://forums.ext.net/showthread.php?17939-How-to-use-MessageBox-Prompt-with-DirectMethod) answer but it is not working

Thank you so much


Edit: Solved!


<Tap Handler="Ext.Msg.prompt('Title', 'Message', function(buttonId, text) {
App.direct.Test(buttonId, text);
});" ></Tap>

fabricio.murta
Oct 29, 2018, 5:03 PM
Hello @PascuV!

Thanks for sharing the solution and, yes, the way to call direct methods is the way you chosen as the fix, so all good.