SharePoint 2010 - JavaScript - Make a field required and add a red asterisk


ran009 on Sat, 19 Jan 2013 01:02:21

Hi I use SharePoint 2010 (can use JQuery and SP Query).

On checkbox select 
 Make a date field required 
 add a red asterisk next to it

Code will be really appreciated.

Thanks folks.


Hemendra Agrawal on Sat, 19 Jan 2013 04:58:33


Here is similar thread to make field mandatory using jquery:

Second way, you can edit your page (if you want this on list forms) in infopath designer and add data validation rule on field to make it mandatory based on chkbox selection.

Can you please let us know where you want this?

AliYasir on Sun, 20 Jan 2013 04:03:21


Dear Indul, request you to do not self propose your answer as correct.

Hi ran009,

You can create a lable and initially keep is display = none.

On javascript, check it $('#controlid').text() == ''

then mark the label display property to block and return false.



if($('#controlid').text == '')
return false;
return true