0

I have two columns: Valor de Estatus and Comments

Valor de Estatus is a select box with values:

0
1
2
3
4

Comments column is a multi line and is not required as default

I want to make column Comments required when user pick Estatus with value 4

UPDATE

I look into another questions you can go to list item validation and apply formula. Problem is you cant select multi line there. Is there any solution can I apply here?

Formula can be something like:

=IF([Valor de Estatus]="4",IF([Comments]<>"",TRUE,FALSE),TRUE)

But I cant pick comments because is a multi line, what can I do there?

0

List validation doesn’t support Multiple lines of text field, so you could use PreSaveAction for this. Sample code:

<script type="text/javascript" src="/_layouts/15/JS/jquery.min.js"></script>
<script type="text/javascript">
    function PreSaveAction() {
        //City is choice field
        var option = $('select[title="City"]').val();
        if (option == "Paris") {
            //Comment is mutiple line text field
            var mutipleTxt=$('div[id^="Comment"]').text();
            alert(mutipleTxt);
            if (mutipleTxt.trim() == "Rich text editor​Rich text editor​".trim()) {
                return false;
                alert("Comment can't be null");
            }
            else
                return true;
        } else {
            return true;
        }
    }
</script>

https://blog.vgrem.com/2014/03/14/introduction-to-client-forms-validation-in-sharepoint-2013/

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.