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

Mar 21, 2013, 10: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?

Mar 22, 2013, 12:13 AM

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">

<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>


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