3 Replies Latest reply: Nov 6, 2014 11:42 AM by Akyron RSS

    Clearing a text field

    srinivas1506 Community Member

      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

        • 1. Re: Clearing a text field
          pguerett techies

          my_text_field_1.rawValue = ""

           

          Paul

          • 2. Re: Clearing a text field
            srinivas1506 Community Member

            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

            • 3. Re: Clearing a text field
              Akyron Community Member

              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