Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Fields that only show when other field has content.

Avatar

Level 1

I have a form that has multiple sign box's. There is the one for the Patient to sign that has the date automatically showing(I've got it working with a global from previous entry). Then I have another sign box below that one for if Patient is unable to sign.

What I want to do is have the date(B) to refer to a previous entry with correct date(A), unless there is information inputed into another field(D), then Field "B" should be blank and Field "C" will have the referance to "A".

Form Example:

Date(A):_____

Patient Signature:___________________Date(B):_____

Representative Signature:_________________________Date(C):_____

Representative Name(D):_________________________

I hope this is enough information in the right format to get the answer to this problem. Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

There are probably a number of ways that you could approach this.

While I would normally try and keep the script in one object/event, here I am going to recommend a small script in the calculate events of dateB and dateC.

dateB calculate event:

if (repName.rawValue === null)

{

     this.rawValue = dateA.rawValue;

}

else

{

     this.rawValue = null;

}

dateC calculate event:

if (repName.rawValue !== null)

{

     this.rawValue = dateA.rawValue;

}

else

{

     this.rawValue = null;

}

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

There are probably a number of ways that you could approach this.

While I would normally try and keep the script in one object/event, here I am going to recommend a small script in the calculate events of dateB and dateC.

dateB calculate event:

if (repName.rawValue === null)

{

     this.rawValue = dateA.rawValue;

}

else

{

     this.rawValue = null;

}

dateC calculate event:

if (repName.rawValue !== null)

{

     this.rawValue = dateA.rawValue;

}

else

{

     this.rawValue = null;

}

Hope that helps,

Niall

Avatar

Level 1

That's what I needed. Thanks to everyone on these boards. I'm able to get this form just the way I wanted it with everyones help.