Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Make Field Required if Another Field's Value Changes from "Please enter Job Responsibility"

Community Beginner ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

I have a form I am developing for Employee Evaluations where the manager is given space to list up to 10 job responsibilities. HR is requesting that the comment section under a job responsibility is mandatory should the field's placeholder text change. 

In essence, I need field "R1 - Comments" to become required if field "Responsibility #1" no longer says "Please enter Job Responsibility". 

I know that I need to leverage custom javascript placed within the validation tab of field "Responsibilty #1" but thus far I have not had any success. This seems rather straight forward but all the examples I have found online are from years in the past and I can't seem to get any of the examples to work properly.

Anyone have an idea? Thoughts? 

Thanks,
Cody Henslee

TOPICS
Create PDFs, General troubleshooting, How to, JavaScript

Views

90

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Apr 21, 2021 Apr 21, 2021
I found a work around by using a custom script on the calculation tab of the comment field. var v = this.getField("Responsibility #1").value; if (v=="Please enter Job Responsibility from Job Description."){event.target.required=false}else{event.target.required=true}

Likes

Translate

Translate
Community Beginner ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Here is the current javascript I have put together but var role is returning "undefined" even though it is populated with "Please enter Job Responsibility"

var role = this.getField("Responsibility #1").value;
var comment = this.getField("R1 - Comments");

if (role!="Please enter Job Responsibility"){
this.getField(comment).mandatory = true;
}else{this.getField(comment).mandatory = false;
}

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

LATEST

I found a work around by using a custom script on the calculation tab of the comment field.

var v = this.getField("Responsibility #1").value;

if (v=="Please enter Job Responsibility from Job Description."){event.target.required=false}else{event.target.required=true}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines