PDA

View Full Version : [CLOSED] Maxlength or other validation in messagebox prompt



jchau
Mar 21, 2013, 9:03 PM
Is it possible to restrict the maxlength of textarea in messagebox prompt to X number of characters such that if validation is broken, they can't click OK?

Baidaly
Mar 21, 2013, 11:13 PM
Hello!

You can access using the following approach textfield of Msg.prompt.

<%@ Page Language="C#" %>
<%@ 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 runat="server">
<title></title>
</head>
<body>

<form id="form1" runat="server">

<ext:ResourceManager ID="ResourceManager1" runat="server" DebugConsole="Ext" />

<ext:Button runat="server" Text="Click me" Handler="var p = Ext.Msg.prompt('Title', 'Enter value', function(button, text) { console.log('Callback function'); }); p.textField.maxLength = 1;"></ext:Button>

</form>
</body>
</html>

Also, you can do additional validation using callback function: http://docs.sencha.com/ext-js/4-2/#!/api/Ext.window.MessageBox-method-prompt