Skip navigation
Currently Being Moderated

Changing presence of text field on different subform with JavaScript

Mar 19, 2010 11:41 AM

I am developing an audit form for my company.  One of the requirements is to have check boxes that either show or hide text fields depending upon the check box's state.  I currently have one form (form1) that has two subforms (Worksheet21 & Worksheet 22).  On Worksheet21 there is a check box named None21.  The initial state of None21 is unchecked.  One Worksheet22 there is a text field with the name None22.  The initial presence of None22 is invisible as set through the object palette.  I need to have a script that causes None22 to become visible when None21 is checked and invisible when None21 is unchecked.  Right now I'm stuck on just getting None22 to become visible.  Here is the code thus far that I have been trying:

 

 

form1.Worksheet21.None21::click - (JavaScript, client)

 

var c=Worksheet22.None22.presence                                                   //Retrieve None22's initial presence for error checking purposes

xfa.host.messageBox("Node: "+c,"Start",2,2);                                      //Message box displays "Node: invisible" and None22 is not showing on the form

 

var i=this.rawValue;                                                                            //Using this for debugging and error checking

xfa.host.messageBox("Value: "+i,"Test",2,2);                                      //When None21 is checked the message box displays "Value: 1"

     if(this.rawValue==1){                                                                     //Check if None21 is checked

          xfa.host.messageBox("Should show now","Showing",2,2);         //Have this in place just so I know the next line should make None22 visible

          Worksheet22.None22.presence="visible";                                //Set None22's presence to visible

          c=Worksheet22.None22.presence;                                          //Retrieve None22's presence to check if the presence was changed

          xfa.host.messageBox("Node: "+c,"Done",2,2);                        //Message box displays "Node: visible" however None22 is not showing on the form

     }

 

As the comments show, apparently the presence of None22 is being changed from invisible to visible but it is not being see on the page.  I am using LiveCycle Designer ES V8.2.1.3144.471865 and viewing the form in Acrobat 9 Pro V9.0.0.  I am also saving the file as an Adobe Dynamic XML Form.  I am an experience programming (VB.NET) and haven't programmed in JavaScript in almost 10 years and just started with LiveCycle about a week ago and this is driving me crazy.  Any help would be greatly appreciated. 

 

 
Replies
  • Currently Being Moderated
    Mar 22, 2010 5:32 AM   in reply to dmarciano

    You may want to post the question in the Designer or Forms forum.  There are a lot of form specific JavaScript experts

    who watch those forums exclusively.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points