1
votes

I have used required field validator to validate a simple textbox and a textbox whose textmode is set to multiline. The validator works fine for the simple textbox , it shows error on clicking the submit button, but it doesnt show the error message for multiline textbox. It validates both the textboxes when I click the submit button 2nd time. I just dont know whats wrong with it. below is the code:

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">

<script type="text/javascript" src="../Scripts/tiny_mce/tiny_mce.js"></script> 
<script type="text/javascript"> 
tinyMCE.init({ 
// General options 
 mode: "textareas", 
theme: "simple",
 encoding: "xml"

 } 
 ); 

 <script type="text/C#">
 public string BodyHtml
 {
  get { return HttpUtility.HtmlDecode(txtDescription.Value); }
  set { txtDescription.Value = value; }
 }

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:Label ID="lblTitle" runat="server" Text="Title (required)"></asp:Label>
 <br /> <asp:TextBox ID="txtTitle" runat="server" Width="557px"></asp:TextBox>
<%--<asp:RequiredFieldValidator ID="reqTitle" runat="server" ErrorMessage="*"ControlToValidate="txtTitle"></asp:RequiredFieldValidator>--%>
<asp:Label ID="lblDescription" Text="Description (required)" runat="server"></asp:Label>


<%--<asp:RequiredFieldValidator ID="reqDescription" runat="server" ErrorMessage="*" ControlToValidate="txtDescription" ></asp:RequiredFieldValidator>--%>



<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Save" 
    onclick="btnSubmit_Click" />
<asp:Label ID="Label1" runat="server"></asp:Label> 

1
It seems to be OK to me. Can you check this in different browser. - Muhammad Akhtar
Can you show complete form design ? - Muhammad Akhtar
may be it is because i m using tiny mce for text editor, well i removed the requiredfield validator , now i m doing server side validation, it takes time but dont have time to figure out whats causing the client side validation to work on 2 clicks... - Mr A

1 Answers

0
votes

Add this to submit button:

OnClientClick="tinyMCE.triggerSave(false,true);"