Expand my Community achievements bar.

SOLVED

Importing XML form data into hidden form fields & making them visible if carrying value

Avatar

Level 1

Hi:

I'm exporting a submitted form's data and importing it into the 2nd -> 3rd -> Etc... Forms, however, a lot of these fields I want to be kept Hidden unless they have a value. When I import the 1st forms' field data, it will import it all smoothly, however if the fields are hidden, you need to go through the selection of check boxes to make them visible again or just have them all visible all the time. I was wondering if there's a feature or coding that would go along the lines of: Once Imported XML /Or/ On "Refresh Fields" button click, go through fields and if Hidden fields now have a value make that Subform/Sub-Subform Visible.

The reason for this is that if you have an incident report form that can take 10 employee names but only 2 were involved in an incident, it would look very cluttery on the investigation form if there's 10 employee name fields, 10 Location Fields, 10 Airplane Fields, Etc... But only 2 employees were involved in a minor incident on the incident report form that didn't involve anything else.

Any suggestions or help would be greatly appreciated, and gratefull thank-yous to any replies.

Kindly,

Al

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Thank you for pointing me in the right direction... A little elbow grease, coffee, patience, and did I mention patience and the following works flawlessly

//Set to Mouse Up of Export Button:

xfa.host.exportData("",0)

//Set to Import Form button of other Forms:

xfa.host.importData()

//Set to Import Form Form:Ready to check the different sections "Check Boxes" to see if that section is suppose to be visible and makes it visible:

if(Button_DelDep.rawValue == 1)

          {

          Del_Dep.presence = "visible";

          }

if(Button_DelArr.rawValue == 1)

          {

          Del_Arr.presence = "visible";

          }

if(Button_Div.rawValue == 1)

          {

          Div.presence = "visible";

          }

if(Button_MADiv.rawValue == 1)

          {

          MADiv.presence = "visible";

          }

if(Button_DelDepXD.rawValue == 1)

          {

          Del_DepXD.presence = "visible";

          }

if(Button_Other.rawValue == 1)

          {

          Other.presence = "visible";

          }

View solution in original post

5 Replies

Avatar

Level 10

I could be wrong but I think because of the nature of hidden fields that won't work. It would work with invisible fields though.

If you are actually hiding fields (for flow, etc.) then you might want to reverse your logic and hide fields that don't have a value after the data has been imported.

Avatar

Level 1

I'm able to import the data into the Hidden fields... The information transfers, it's just that the Action Script where if the certain check boxes are selected it will make that part of the form Visible does not occur so the information transfers into the Hidden Fields and those fields remain Hidden unless you reselect the appropriate check boxes. I'll make a quick desktop video to show you what I mean...

Avatar

Level 10

I don't know if this will work but you could try adding xfa.form.remerge(); or xfa.layout.relayout(); to your script, one of those might retrigger everything.

Hopefully Niall will pop in with an idea.

Avatar

Level 1

Hi Moore:

I tried both scripts under a click action of a button with no-joy. I really appreciate your feedback though.

I created and linked a really terrible demo-video to help clarify what I'm trying to accomplish, hope it helps:

http://www.youtube.com/watch?v=MngGihdORVk

Thank you

Avatar

Correct answer by
Former Community Member

Thank you for pointing me in the right direction... A little elbow grease, coffee, patience, and did I mention patience and the following works flawlessly

//Set to Mouse Up of Export Button:

xfa.host.exportData("",0)

//Set to Import Form button of other Forms:

xfa.host.importData()

//Set to Import Form Form:Ready to check the different sections "Check Boxes" to see if that section is suppose to be visible and makes it visible:

if(Button_DelDep.rawValue == 1)

          {

          Del_Dep.presence = "visible";

          }

if(Button_DelArr.rawValue == 1)

          {

          Del_Arr.presence = "visible";

          }

if(Button_Div.rawValue == 1)

          {

          Div.presence = "visible";

          }

if(Button_MADiv.rawValue == 1)

          {

          MADiv.presence = "visible";

          }

if(Button_DelDepXD.rawValue == 1)

          {

          Del_DepXD.presence = "visible";

          }

if(Button_Other.rawValue == 1)

          {

          Other.presence = "visible";

          }

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----