1.Add bellow script after <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" src="../../SiteAssets/jquery-1.8.2.min.js"></script >
<script type="text/javascript" src="../../SiteAssets/jquery.SPServices-2014.01.min.js"> </script>
<script type="text/javascript">
Single Line Text Box:
var DueDate=$("input[title='Due Date']").val();
if(typeof(DueDate) == "undefined" || DueDate== null || DueDate=="")
{
alert("Please Enter Due Date.");
$("input[title='Due Date']").focus();
return false;
}
Note : Here Due Date is List Column Name
Muti Line Text Box with Plain Text:
var Name =$("textarea[title='Name']").val();
if( Name=="")
{
alert("enter Name");
$("textarea[title='Name']").focus();
return false;
}
Muti Line Text Box With Rich Text:
if($('#tdDetails div[role=textbox]').text().length<=1)
{
alert("Please Enter Details.");
return false;
}
Here control is present in the tdDetails is TD id of table.
Drodown List:
var LocationId= $("select[Title='Location']").attr("id");
var LocationControl= document.getElementById(LocationId);
var strLocation= LocationControl.options[LocationControl.selectedIndex].text;
if(strLocation=="(None)")
{
alert("Please select the Location value");
return false;
}
<script type="text/javascript" src="../../SiteAssets/jquery-1.8.2.min.js"></script >
<script type="text/javascript" src="../../SiteAssets/jquery.SPServices-2014.01.min.js"> </script>
<script type="text/javascript">
Single Line Text Box:
var DueDate=$("input[title='Due Date']").val();
if(typeof(DueDate) == "undefined" || DueDate== null || DueDate=="")
{
alert("Please Enter Due Date.");
$("input[title='Due Date']").focus();
return false;
}
Note : Here Due Date is List Column Name
Muti Line Text Box with Plain Text:
var Name =$("textarea[title='Name']").val();
if( Name=="")
{
alert("enter Name");
$("textarea[title='Name']").focus();
return false;
}
Muti Line Text Box With Rich Text:
if($('#tdDetails div[role=textbox]').text().length<=1)
{
alert("Please Enter Details.");
return false;
}
Here control is present in the tdDetails is TD id of table.
Drodown List:
var LocationId= $("select[Title='Location']").attr("id");
var LocationControl= document.getElementById(LocationId);
var strLocation= LocationControl.options[LocationControl.selectedIndex].text;
if(strLocation=="(None)")
{
alert("Please select the Location value");
return false;
}
No comments:
Post a Comment