Skip to main content
Participating Frequently
Jul 22, 2018 6:14 AM UTC
Question

How to I do to let the specific field be hidden?

1) Initially, Field A and Field B are visible for person to input.

2) During input some words in Field A (eg. Peter)

3) After input words, Field B is hidden. Person cannot input anything in Field B.

4) If I delete the words in field A (Become blank), Field B becomes visible again.

I don't know how to make the java-script code for this activity. Would you mind help me design? Thank You.

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

leafchanAuthor
Participating Frequently
Jul 22, 2018 11:45 AM UTC

Thank you for your reply. It save me a lot of time.

Translate
BarlaeDC
Community Expert
Community Expert
Jul 22, 2018 8:13 AM UTC

Hi,

Add this code to the validation event of Field A

if ( event.value !== "")

{

     // replacing to use recommended method

     // [DEPRICATED} this.getField("Field B").hidden = true;

     this.getField"Field B").display = display.hidden;

}

else

{

     // replacing to use recommended method

     // [DEPRICATED] this.getField("Field B").hidden = false;

      this.getField"Field B").display = display.visible;

}

Make sure the text inside the quotes matches the name of Field B.

Hope this helps

Malcolm

{edit: as per comment below, to make sure anyone finding in the future gets the correct code )

Translate
try67
Community Expert
Community Expert
Jul 22, 2018 9:24 AM UTC

It is not recommended to use the hidden property, since it has been deprecated.

You should use the display property instead, like this:

this.getField("Field B").display = display.hidden;

Or:

this.getField("Field B").display = display.visible;

Translate