0

I have a multi line column named "Business Justification". I have to validate it to show whether it is empty or not.

 if($('nobr:contains("Business Justification")').closest('tr').find('.ms-rtestate-write').val()== "")
         { 

            alert('provide business justification');
            return false;}

I used the above code but this gives the alert message even if value is given

0

Use below:

var content=$("nobr:contains('Field Name')").parent().parent().parent().find("div.ms-inputBox div.ms-rtestate-write").text()
if (content.trim() == "")  
{ 
     alert("empty");
}

Replace the 'Field Name' token with column display name

  • the if condition doesnt work ......the value is still saved when the textbox in empty – sweta Nayak Mar 27 '18 at 11:55
  • Please share the MLT type- Enhanced rich or rich text box in SharePoint – Deepmala Mar 28 '18 at 3:54
  • its enhanced rich text – sweta Nayak Mar 28 '18 at 4:20
  • Try to log the value. There could be some hidden html tags in the textbox – Deepmala Mar 28 '18 at 4:39
0

Please try using the below code instead

if($(".ms-rtestate-write[id^='Business_x0020_Justification']")[0].innerHTML=="<p>​</p>")
{
     alert('provide business justification');
                return false;
}
else 
     return true;

try and feedback

  • this is not working – sweta Nayak Mar 28 '18 at 4:19
-1

Try to make Business Justification mandatory.

http://dhirendrayadav.com/2010/06/make-existing-custom-column-required-in.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.