PDA

View Full Version : [CLOSED] Validation in Multi-line Prompt



CarWise
Oct 02, 2012, 9:16 AM
Hi guys,

Is it possible to use something like AllowBlank = false on the multiline prompt so that the multiline textField get's the red border like normal happens when validating a simple textfield ?

Ofcourse I can check if the text variable is empty and show an alert, but i would like to make is 'smooth' :)

Regards,

Martin

Daniil
Oct 02, 2012, 10:37 AM
Hi Martin,

This way:

Example


Ext.Msg.show({
msg: "Message",
multiline: true
});

Ext.Msg.textArea.allowBlank = false;

CarWise
Oct 02, 2012, 11:14 AM
Hi Martin,

This way:

Example


Ext.Msg.show({
msg: "Message",
multiline: true
});

Ext.Msg.textArea.allowBlank = false;

Not really sure were i'm wrong, but I can't in my code ...



<%@ Page Language="C#" %>
<script runat="server">
[DirectMethod]
public void AreYouSureClose()
{
X.Msg.Show(new MessageBoxConfig
{
Title = "Sluiten",
Message = "Reden sluiten issue",
Width = 300,
Buttons = MessageBox.Button.OKCANCEL,
Multiline = true,
AnimEl = tbClose.ClientID,
Fn = new JFunction { Fn = "closeIssue" }
});
// Ext.Msg.textArea.allowBlank = false; //Not correct
}


[DirectMethod]
public void closeIssue(String text)
{
// Save information
}


</script>


<!DOCTYPE html>


<html>
<head id="Head1" runat="server">
<title>MultiLine Validation</title>
<script type="text/javascript">
var closeIssue = function (btn, text) {
if (btn != "cancel") {
if (text != "") {
App.direct.closeIssue(text);
}
else {
alert("Empty");
}
}
};
</script>
</head>
<body>
<form id="Form2" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<div>
<ext:Button ID="tbClose" runat="server" Text="Sluiten" Icon="Lock">
<Listeners>
<Click Handler="App.direct.AreYouSureClose()" />
</Listeners>
</ext:Button>
</div>
</form>
</body>
</html>

Daniil
Oct 02, 2012, 11:21 AM
It is JavaScript.

Please use:

X.Js.AddScript("Ext.Msg.textArea.allowBlank = false;");

CarWise
Oct 02, 2012, 12:00 PM
It is JavaScript.

Please use:

X.Js.AddScript("Ext.Msg.textArea.allowBlank = false;");

Ah.. that makes it more clear :)

Martin