11 Replies Latest reply on Sep 26, 2011 5:52 AM by pguerett

    Highlight Text in FormCalc

    kennyboy2001

      Hi all,

       

      LiveCycle Designer 8.1

       

      I see in the documentation examples of setting the color of a fillable area (background color) of a text field in JavaScript

      but I see no example of this in FormCalc. Can any one provide any pointers?

       

       

      Thanks ~ Ken

        • 1. Re: Highlight Text in FormCalc
          kennyboy2001 Level 1

          I actually sort of figured this out...but still have a problem.

           

          FormCalc on exit

           

          If the target text field is on the same page, the code below works great:

          form1.Win_Opp_3.WO_text2.ui.oneOfChild.border.fill.color.value = "255,255,128";

           

          Unfortunately, my target field is on the Master Page and it will not work. The code I'm using for this is:

          form1.#pageSet[0].Page1.mEvaluate.ui.oneOfChild.border.fill.color.value = "255,255,128";

           

          Does anyone know how to do this?

           

          Thanks ~ Ken

          • 2. Re: Highlight Text in FormCalc
            pguerett Level 6

            The code is fine ...it the reference to yoru field that is the issue. Put this command on the enter event of the field on teh MasterPage    app.alert(this.somExpression)    . Now render your form and enter the field ...the somExpression will appear. That is the reference that you shodul be using. My guess is that there is more than one Page1 instance. Don't forgrt to remove the app.alert on the field when you are finished.

             

            Paul

            • 3. Re: Highlight Text in FormCalc
              kennyboy2001 Level 1

              pguerett,

               

              I gave that a try:

               

              The alert returned: xfa[0].form[0].form1[0].#pageSet[0].mEvaluate[0]  (I then commented out that code in the Master Page field)

              Snap100.jpg

              I modified my line of code to: xfa[0].form[0].form1[0].#pageSet[0].Page1[0].mEvaluate[0].ui.oneOfChild.border.fill.color .value = "255,255,128"

              The script did not run and said "Error: accessor.....with that line of code"

               

              Interestingly enough, this line of code works in the same script:  form1.#pageSet[0].Page1.mEvaluate = "Yes";  (FormCalc)

               

              I did check and there is only 1 Page 1 instance that I can see

               

              Thanks ~ Ken.

              • 4. Re: Highlight Text in FormCalc
                pguerett Level 6

                Can you send the form to LiveCycle8@gmail.com and I will have a look.

                 

                Paul

                • 5. Re: Highlight Text in FormCalc
                  kennyboy2001 Level 1

                  Paul,

                   

                  Thanks,

                   

                  The script is in the last drop-dwon on the last page and the master field in in the header on far right.

                   

                  One its way...

                   

                  Thanks so much!   Ken

                  • 6. Re: Highlight Text in FormCalc
                    pguerett Level 6

                    It is as I suspected .....your script is changing the 1st instance of the field on teh Master Page (on Page 1).

                     

                    Paul

                    • 7. Re: Highlight Text in FormCalc
                      kennyboy2001 Level 1

                      Paul,

                       

                      Thanks so much. I learned a lot here. Your trick about interrogating the field itself is interesting. i.e - app.alert(this.somExpression)

                       

                      I now understand what you mean by the Page[ ] reference which I did not get before.

                      I also now understand the reference to multiple instances of the page...quite interesting. I'm not sure why I can set the rawValue across all pages but not an object attribute ... but I actually see this as a plus as it extends flexibility. Your for loop technique solves the problem nicely.

                       

                      Thanks for your extended help!

                       

                      All my best ~ Ken

                      • 8. Re: Highlight Text in FormCalc
                        kennyboy2001 Level 1

                        Hey Paul,

                         

                        If you still have that form I sent...one more question which confuses me a bit.

                         

                        Also in the Master Page, I have a checkbox in the upper right called "Question Num" (checkbox label)

                        This checbox shows or hides question numbers on the pages.

                         

                        If I set the colored area in the Master as we were discussing with the drop-down and then check the "Question Num" checkbox, the colored area of the other object goes white. This one is a bit strange.

                         

                        Any ideas?

                         

                        Thanks ~ Ken

                        • 9. Re: Highlight Text in FormCalc
                          pguerett Level 6

                          You can add commands to check th eoriginal color of the field and set it after all th ecode on th echeckbox has been executed. So add this to the end of the checkbox script:

                           

                           

                          var origColor = mEvaluate.ui.oneOfChild.border.fill.color.value

                          for i=0 upto 13 step 1 do

                          form1.#pageSet.Page1[i].mEvaluate.ui.oneOfChild.border.fill.color.value = origColor; // Master Page

                          endfor

                           

                          Note that you do not neccessarily need the for loop you can do the same thing in formcalc using the * notation for occurances ..like this:

                           

                          var origColor = mEvaluate.ui.oneOfChild.border.fill.color.value

                          form1.#pageSet.Page1[*].mEvaluate.ui.oneOfChild.border.fill.color.value = origColor; // Master Page

                           

                           

                          Paul

                          • 10. Re: Highlight Text in FormCalc
                            kennyboy2001 Level 1

                            Hi Paul,

                             

                            For some reason that does not work.

                            I tried the for loop - seems to have no affect as the colors still blank out

                             

                            Other ideas?

                             

                            Thanks ~ Ken

                            • 11. Re: Highlight Text in FormCalc
                              pguerett Level 6

                              I tried it here and it worked fine ....are you sure you typed it on correctly and put it on the correct event?

                               

                              paul