Expand my Community achievements bar.

Subform add Instance problem

Avatar

Level 1

G'day

I'm very new to LiveCycle and teaching myself to create forms

I have a drop down box in a subform requesting information. Depending on the information required certain text boxes will appear (using switch case script) dateFrom dateTo dateCourt txtOther

When I add a new instance of this subform the list appears correctly in the drop down box but when the item is selected the text boxes do not appear at all.

I am probably missing something fundamental. Any ideas

Cheers

Capture.GIF

//cboInfoRequired

RFI.InfoRequested.Info.cboInfoRequired::exit - (JavaScript, client)

switch(RFI.InfoRequested.Info.cboInfoRequired.rawValue){

  case "Info A":

  RFI.InfoRequested.Info.dateFrom.presence = "visible";

  RFI.InfoRequested.Info.dateTo.presence = "visible";

  RFI.InfoRequested.Info.dateCourt.presence = "hidden";

  RFI.InfoRequested.Info.txtOther.presence = "hidden";

  break;

  case "Info B":

  RFI.InfoRequested.Info.dateFrom.presence = "hidden";

  RFI.InfoRequested.Info.dateTo.presence = "hidden";

  RFI.InfoRequested.Info.dateCourt.presence = "visible";

  RFI.InfoRequested.Info.txtOther.presence = "hidden";

  break;

  case "Info C":

  RFI.InfoRequested.Info.dateFrom.presence = "hidden";

  RFI.InfoRequested.Info.dateTo.presence = "hidden";

  RFI.InfoRequested.Info.dateCourt.presence = "hidden";

  RFI.InfoRequested.Info.txtOther.presence = "visible";

  break;

  case "Info D":

  RFI.InfoRequested.Info.dateFrom.presence = "hidden";

  RFI.InfoRequested.Info.dateTo.presence = "hidden";

  RFI.InfoRequested.Info.dateCourt.presence = "hidden";

  RFI.InfoRequested.Info.txtOther.presence = "hidden";

  break;

  }

//cmdAdd

RFI.InfoRequested.AddInfo.cmdAdd::click - (JavaScript, client)

RFI.InfoRequested.Info.instanceManager.addInstance(1);

3 Replies

Avatar

Level 10

Hi,

the problem is your SOM expression.

When you write RFI.InfoRequested.Info.dateFrom.presence = "hidden"; the PDF-viewer interprets it always as RFI[0].InfoRequested[0].Info[0].dateFrom[0].presence = "hidden"; where the accessor [n] is always 0 which means the first instance of the related object.

It should work if you just write dateFrom.presence = "hidden"; because the object is at the same level in the hierarchy and there is no need to parse the entire tree to find the object.

Avatar

Level 1

G'day Radzmar

Thank you for the quick reply. It worked...sort of.

The first instance selects the correct case

The second replicates the first instance but I cannot select a new case

Eg if I select Info A then it will only show dateFrom and dateTo

Then I add instance

Then when I select Info C it will still only show dateFrom and dateTo eventhough it should only show txtOther

Does that make sense?

Cheers

Avatar

Level 1

Radzmar

Please disregard the above reply....I forgot one line to change.

It all works beautifully now.

Thank you so much

Cheers

Mark