I have a ascx file in which i am using text box with tinyMCE editor. code is following..
<asp:TextBox ID="txbDiag" TextMode="MultiLine" runat="server" Width="100%" Height="100px"/>
<acr3s:tinymceextender runat="server" ID="TinyMceExtender4" TargetControlID="txbDiag" Theme="Full"/>
like this i have using 5 text box with tinyMCE extender
I am trying to validate my textbox with spacebar, If someone open my page and in text box click on spacebar and click on btn save it should not accept the value and give the error field should not be empty. the code which i use to validate is
if (txbDiag.Text.Trim().Length <= 0)
{
msgError.Text = "<b><font Color=red>*" + "fields are mandatory"+"</font>";
msgError.Focus();
return false;
}
and on btn click i use
txbDiag.Text.Trim();
but while clicking on btn save page is getting saved.
i used the js
<script type="text/javascript">
function validate(e) {
var unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode == 32) {
return false;
}
else {
return true;
}
}
</script>
but this is also not working
I used regular expression and requir field validation that also not causing validation
HOW COULD I VALIDATE MY TEXT BOX FROM SPACEBAR HELP ME????
1 Answer