Hiding Subforms Based on Value of Object Set by XML Binding

ellenk76580830

06-06-2018

Hello!

I have searched multiple forums and tried all the hints; yet I still am struggling.

Form is Dynamic and Flowed; however all the data is populated into the form based on mapped values from an XML.  Users are entering data in an application and once complete the user generates the data into the form I've built.  So all the data is imported into the form via XML.

I have 5 subforms and only 1 should display based on the value of an object populated by the XML Mapping.

The object value name is WaiverType.  The XML will populate 1 of 5 values for WaiverType.  The values are: I/DD, FE, PD, TA, TBI

The 5 subforms are named based on the WaiverType values.  Five subform names are: IDD, FE, PD, TA, TBI

I have tried to utilize events of: Doc Ready, Form Ready and Layout Ready - based on reading all the feedback online of events to use.

Below is my javascript:  (note: I'm just showing you the first WaiverType as an example):

if (WaiverType.rawValue == 'I/DD') {

  
IDD.presence = "visible";

}

else {

   
IDD.presence = "hidden";

}

Again, I have tried multiple events, unfortunately all FIVE of the subforms still remain visible when I select to create the form once the value of WaiverType is set.  Either there is another Event that I should be using OR my javascript is bad.

Any help is appreciated!!!!

Accepted Solutions (0)

Answers (3)

Answers (3)

ellenk76580830

06-06-2018

SUCCESS!  Wanted to let folks know I resolved my problem in the event this happens to any of you out there!

By putting in the app.alert (so simple!) I could identify the script was not triggering where I had it in the form.  I moved up the script to occur right after the WaiverType was populated by the application - using the FORM READY event.

Thanks Magus069!

ellenk76580830

06-06-2018

Thanks so much for your reply.

I've added in the app.alert .  I put it right after the WaiverType object on the event "form ready".  When I execute the form I get TWO alerts - the first value is NULL and the second value shows correctly.  Why is it displaying it twice when I only have the app.alert in one spot?  I attempted to put in the app.alert for the 5 subforms on all 3 events as I noted in  my first post - but it never even hits those app.alerts.

Any guidance is appreciated.

Magus069

MVP

06-06-2018

Hi there,

it's hard to say without having a direct look at it and why it doesn't behave the right way... maybe you should verify the rawValue of WaiverType, use app.alert(WaiverType.rawValue); to verify if the code is executed and/or what part is being executed.

Also just a quick question, are you verifying through JavaScript Debugger if any errors may occur when testing your form?