Expand my Community achievements bar.

Clearing a text field

Avatar

Level 8

Hello

I have a text field in the form.

In some condition, i want to CLEAR it, pls. let me know the JavaScript code for it?

if (myCondition = "X"){

CLEAR my_text_field_1

}

THANK YOU

3 Replies

Avatar

Level 8

Thank you.

In another case, my requirement is as below,

if( my_text_field_1 == BLANK){

my_text_field_2.rawValue = "Blank"

}

if( my_text_field_1 = null){

my_text_field_3.rawValue = "NULL"

}

1) Pls. let me know How can code for this BLANKL, is it a single space like ""...........if so, if user enters 2 spaces or 3 or 4 spaces, wht happens in that case?

2) Pls. consolidated the above JavaScript in a best practice way

THank you

Avatar

Level 2

I have a similar issue. I have instructions in a livecycle field. I would like to clear the instructions when the clicks or tabs into the field to type data. I would like this to happen one time and one time only since I expect data will be in the field after the first time.

Thank you.

akyron