Expand my Community achievements bar.

SOLVED

Hidden table reappearing on submit, fragment and button not appearing

Avatar

Former Community Member

Hello,

I am new to JavaScript and would like some assistance.

I have three tables in a form. Users can remove these tables if their not required by pressing a button called 'no'. This sets the table presence to 'hidden'.

I have a button on the form for submit (not an actual submit button) that has some validations on it and then submits by email.

The code works except for three issues. The first is that any table (Orientation, SkillDevelopment, ExamPrep) that I have 'hidden' reappears on submit. I want them to remain hidden after submission. A 'fragment'(OfficeUseOnly) that I have created that I would like to appear on submit doesn't, and my ellipses (a hidden button) will not appear although I have set it's presence to visible in my JavaScript on the click event of submit.

I am working on the assumption that there is an issue with the below code(which occurs on the click event of my button that submits the form) somewhere that is making  these things happen, or in the case of my appearing ellipses and fragment, not happen.

I have used this code in other forms, with slight variations, and all seems to work ok although the other forms have not involved an item that has been hidden before.

Just a note: the BankDetails, Print and SaveAs 'hidden' all works ok. Where am I going wrong?

Here is the code

var boValidation = true;

if(Orientation.presence == "visible" && Orientation_Subtotal.OreintationDocs.OreintDocsNo.rawValue == "2" || SkillDevelopment.presence == "visible" && SkillDevSubTOtal.SkillDevDocs.SkillDevDocsN0.rawValue == "3" ||

ExamPrep.presence == "visible" && ExamPrepSubTotal.ExamPrepDocs.ExamPrepDOcsNo.rawValue == "2")

{

boValidation = false;

app.alert("You have etc..........");

BodyConfirm.presence = "visible";

}

if(boValidation)

{

var var0 = xfra.resolveNode("Details.email").rawValue;

var var1 = "Travel & Expenses Invoice: " + xfa.resolveNode("Detail.NameComapany").rawValue;

event.target.mailDoc({

bUI: false,

cTo: "forms@",

cCc: var0,

cSubject: var1,

cMsg: "Thank you for submitting your form......"

});

BankDetails.presence = "hidden";

Print.presence = "hidden";

SaveAs.presence = "hidden";

OfficeUseOnly.presence = "visible";

Ellipses.presence = "visible";

}

Just a reminder that I know very little about JavaScript. The above code was sourced from someone else that I have adapted to my needs.

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Under Form ... Properties ... Run-Time ... Preserve Scripting Changes, is it set to automatic or manual.  Manual will mean that you need to restore the presence values yourself whenever the form is opened.  You probably wont Automatic

Regards

Bruce

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Under Form ... Properties ... Run-Time ... Preserve Scripting Changes, is it set to automatic or manual.  Manual will mean that you need to restore the presence values yourself whenever the form is opened.  You probably wont Automatic

Regards

Bruce

Avatar

Former Community Member

Hi Bruce,

Thank you! That has resolved the issue with the reappearing table.

I am still struggling with the two other issues however.

I have now noticed that after submission, if I submit the form for a second time, the necessary objects appear. Will it help my cause if I put the necessary presence code in the preSubmit or postSubmit event?

Thanks for your assistance

Avatar

Former Community Member

Fixed! For whatever reason moving the Ellipses.presence etc. section of code above the email submission stuff seems to have worked!

Thanks!