Friday, July 19, 2013

InputFormTextBox Validation(Rich TextBox in Sharepoint)

InputFormTextBox Validation(Rich TextBox in Sharepoint)

In this post I will tell how to validate the InputFormTextBox contol using custom JavaScript function…if u Use  RequiredFieldValdator or InputFormRequiredFieldValidator with InputFormTextbox  U ll get some validation Issues Onclick Validation Button…Instead of RequiredFieldValidation  Just do with CustomValidator .

This is an example of Client-side validation Using Cutomvalidator…

<sharepoint:InputFormTextBox ID=”txtDetailInfoRequired” CausesValidation=”true”
AllowHyperlink=”true” RichText=”true” RichTextMode=”FullHtml” runat=”server” TextMode=”MultiLine” Rows=”6″ Columns=”10″ />
<asp:CustomValidator ID=”CustomeDetails” runat=”server” ValidationGroup=”validate”  ClientValidationFunction=”ValidationForRichDetails” ControlToValidate=”txtDetailInfoRequired” SetFocusOnError=”true” ValidateEmptyText=”true” Display=”Dynamic” ErrorMessage=”*”>

Inside  Javascript tag Define this function...

<script language=”javascript” type=”text/javascript”>
function ValidationForRichReason(source, arguments) {
var text = RTE_GetRichEditTextOnly(“<%= txtReasonofrequest.ClientID %>”);
if (text != “”) {
arguments.IsValid = true;
else {
//set focus back to the rich text editor.
RTE_GiveEditorFocus(“<%= txtReasonofrequest.ClientID %>”);
arguments.IsValid = false;


<asp:Button ID=”btnSubmit” runat=”server” Text=”Submit”  CssClass=”nav_new” ValidationGroup=”validate” />

if any doubts please comments here...good luck

1 comment:

  1. It's enjoyable to learn more and more from your blog. Thanks for sharing.