Expand my Community achievements bar.

SOLVED

Reset button does not reset field color.

Avatar

Level 2

Can't find the solution.

I have scripts that highlight the field background color if the value is out of range.  Also, resets the color back if the range is OK.  This works just fine.

When I reset the form (with button), the field values reset OK, but the field color stays highlighted if that was the state.

The form initially opens with no hightlighting.  How do I reset the form values and remove the highlighting?

Thanks,

Wendell

1 Accepted Solution

Avatar

Correct answer by
Level 10

I found the issue with your form..

1) You have to save your form as Dynamci XML Form. (File -> Save As and choose Dynamic instead of Static).

2) In the File -> Form Properties under Default tab, at the bottom, For PDF Render Format, you chose, Static XML form. Change it to Dynamic XML Form.

3) Similarly under Preview tab,  change the Static XML form to Dynamic.

Then your form should work as expected.

Thanks

Srini

View solution in original post

9 Replies

Avatar

Former Community Member

You can add code to the reset button click event to set the colour back to the background colour of the form. For example, the following code checks if the border fill colour is "51,153,102" (green). If it is, set it to "255,255,255" (white).

//form1.page1.subform1.resetBtn::click - (JavaScript, client)

xfa.host.resetData();

if (xfa.resolveNode("form1.page1.subform1.bar.ui.#textEdit.border.fill.color").value == "51,153,102") {

          xfa.resolveNode("form1.page1.subform1.bar.ui.#textEdit.border.fill.color").value = "255,255,255";

}

Steve

Avatar

Level 10

Reset command/ button will only clear the fields.

Try placing the below command in the click event of the Reset Button as the last line of code.

     xfa.form.remerge();

Thanks

Srini

Avatar

Level 2

Srini, Steve,

Neither of these approaches worked.

I can add code like this to the button-click and it works

 

Num4.fillColor = "255,255,255";

Num5 fillColor = "255,255,255";

There are about 400 fields in this form.

In AcroForm, you could use heirachies, line Num.4 and Num.5 to operate on a set of fields.

Is there a similar way to do this in LiveCycle? Do I need to name the fields differently?

Avatar

Level 10

See the attached sample, if it helps.

https://acrobat.com/#d=nLIIqGnOSKfoCobCKS5XKA

I have 4 fields and resetting all the 4 field's fill color with one command.

Thanks

Srini

Avatar

Level 2

Srini,

Indeed, your solution works perfectly on your form.

I put it in my form's Button-Click and it still only removes the value, but not the color.

 

topmostSubform.Page1.ResetButton1::click - (JavaScript, client)

 

xfa.host.resetData();

xfa.form.remerge();

A mystery.

Wendell

Avatar

Level 10

Can you share your form so I can have a look at it..

Please mention what needs tobe done to get the back ground color to the fields.

Steps to share a document..

1. Go to URL http://Acrobat.com
2. Create an account if you don't have one.
3. Then login to the website.
4. In top left corner you will see a button called Upload.
5. Click on browse and select the file you want to upload.
6. After Uploading, mouse over on the uploaded file. Click the down arrow button and choose Share document.
7. Then you will be prompted a popup window at the lower left corner. Choose "Publish it" option.
8. In the next pop up window choose "Copy Link" option.
9. You can paste the link in the forum thread.

Thanks

Srini

Avatar

Level 2

Srini,

I copied a field from my form to your form and the color reset OK.  There must be  problem with my form structure.

I've only put in two rows of fields to test before I populate the whole form.

The column "Aged Reconciled" highlights yellow if any value other than zero is present.  This impacts the column to the right that also is wanting only zero and will highlight in red.  If you enter zero in "Aged Reconciled" the highlighting turns off for both fields.

https://acrobat.com/#d=nJ2EpEQ0XT0vGZ8samQHEQ

Thanks for your help!

Wendell

Avatar

Correct answer by
Level 10

I found the issue with your form..

1) You have to save your form as Dynamci XML Form. (File -> Save As and choose Dynamic instead of Static).

2) In the File -> Form Properties under Default tab, at the bottom, For PDF Render Format, you chose, Static XML form. Change it to Dynamic XML Form.

3) Similarly under Preview tab,  change the Static XML form to Dynamic.

Then your form should work as expected.

Thanks

Srini

Avatar

Level 2

Thanks Srini,

This was the solution.  Thanks for your perserverance.

Wendell