These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to reset field fill color? urgent

smilem
Registered: Apr 1 2008
Posts: 101
Answered

I have a form in livecycle 8 and I colored some fields like this:

on events I used "on change"

$.ui.oneOfChild.border.fill.color.value = "255,249,203"; // yellow

Now I added reset button:

and script to "click"

xfa.host.resetData("[my field name]")

It does not reset the color back HELP :)

My Product Information:
LiveCycle Designer, Windows
StevenD
Registered: Oct 6 2006
Posts: 368
It sounds like you are trying to change the fill color from an original color to yellow then back to the original color ie. black to yellow then back to black. Right?

StevenD

smilem
Registered: Apr 1 2008
Posts: 101
StevenD wrote:
It sounds like you are trying to change the fill color from an original color to yellow then back to the original color ie. black to yellow then back to black. Right?
Yes that is correct.
scottsheck
Registered: May 3 2007
Posts: 138
How about just setting it to Black instead of resetting it.
smilem
Registered: Apr 1 2008
Posts: 101
scottsheck wrote:
How about just setting it to Black instead of resetting it.
Well the command to reset normal fields is:

xfa.host.resetData("[my field name]")

But if I have a colored field it does not reset the color. I tried to color them to original "white" color using

$.ui.oneOfChild.border.fill.color.value = "255,255,255"; // white

But they look diferent, (horizontal borders missing) so that is not a solution.

If there is a command to color it and there is an option to "none" so what is command to set fill to "none"?
StevenD
Registered: Oct 6 2006
Posts: 368
I think you may be using FormCalc which I do not know very well here is some JavaScript to try out. Be sure to change the scripting language to JavaScript in the Language field at the top right of the

You could try using the following to restore the fields and fillable areas and sub forms to their original state.

xfa.form.remerge();

You could also try to set the fill color back to let's say white by using the following in the click event.

xfa.resolveNode("TextField1.ui.#textEdit.border.fill.color").value = "255,255,255";

Give those a try and see what happens.

Incidentally the method you are using to reset the fields will only reset the data in the field to the default value which would either be nothing or the default value as specified by the author in the Object > Value tab.

StevenD

smilem
Registered: Apr 1 2008
Posts: 101
StevenD wrote:
I think you may be using FormCalc which I do not know very well here is some JavaScript to try out. Be sure to change the scripting language to JavaScript in the Language field at the top right of theYou could try using the following to restore the fields and fillable areas and sub forms to their original state.

xfa.form.remerge();

You could also try to set the fill color back to let's say white by using the following in the click event.

xfa.resolveNode("TextField1.ui.#textEdit.border.fill.color").value = "255,255,255";

Give those a try and see what happens.

Incidentally the method you are using to reset the fields will only reset the data in the field to the default value which would either be nothing or the default value as specified by the author in the Object > Value tab.
I tried xfa.form.remerge();

It does not reset color but does not damage how text fields look.

Tried xfa.resolveNode("TextField1.ui.#textEdit.border.fill.color").value = "255,255,255";

It damages how text fields look, if I have sunken or solid text field and reset it like this the border where you type text dissapears.

Isnt there away to reset fill to "none" I can choose background fill by selecting "Border" tab, then "Background fill" then "Style" click "none".

How to do above with code?
twhayes
Registered: Sep 25 2007
Posts: 20
Try:

<mytextcontrol>.ui.textEdit.border.fill.presence = "hidden"; or

 <mytextcontrol>.ui.textEdit.border.fill.presence = "visible";

My experimentation shows that setting the color is automatically changing the presence to "visible". To set it back to none, you need to just set the presence back to "hidden". By default, the "standard" objects in the Library pane do not define a lot of the properties... this means that if you *ever* change a property of one of these and then change it back to what you think the default was, then that particular object/control may behave differently from other objects for which you have never changed that property. "Save As" your form as an XPD and then open that in WordPad and you can spot most differences pretty quickly by looking at the XML code therein.


Regards,
smilem
Registered: Apr 1 2008
Posts: 101
twhayes wrote:
Try:
<mytextcontrol>.ui.textEdit.border.fill.presence = "hidden"; or

 <mytextcontrol>.ui.textEdit.border.fill.presence = "visible";

My experimentation shows that setting the color is automatically changing the presence to "visible". To set it back to none, you need to just set the presence back to "hidden". By default, the "standard" objects in the Library pane do not define a lot of the properties... this means that if you *ever* change a property of one of these and then change it back to what you think the default was, then that particular object/control may behave differently from other objects for which you have never changed that property. "Save As" your form as an XPD and then open that in WordPad and you can spot most differences pretty quickly by looking at the XML code therein.


Regards,
Do I need to use these on my reset button or text fields?

Now this is strange,

See works.pdf where everything works fine:
http://rapidshare.com/files/107951806/works.pdf.php

Now I have copied button and text fields including dropdown to new empty document and it does not work, border dissapears.
http://rapidshare.com/files/107952236/donotwork.pdf.php

Where is the problem ?
twhayes
Registered: Sep 25 2007
Posts: 20
the "donotwork" is saved as a static form? maybe...
smilem
Registered: Apr 1 2008
Posts: 101
twhayes wrote:
the "donotwork" is saved as a static form? maybe...
No it is saved as Dynamic. Do not be so lazy and download the files.
twhayes
Registered: Sep 25 2007
Posts: 20
Um, I had downloaded the forms to play with them earlier and noticed that it looked like it was saved as static.

I have just reopened the file and it appears to me that the donotwork.pdf was saved as static. If I open it, then go to File, Form Properties, then Compatibility. It states: "Acrobat 7 (Static) PDF Form". But, in the Defaults tab, the Preview has been set to "Acrobat 7 (Dynamic) XML Form".

If you choose Save As it is defaulting to a static form. Then change the type to dynamic, and save it with another name. Now it works just fine in the Preview! (It happens to us all, at one time or another.)


Regards,
smilem
Registered: Apr 1 2008
Posts: 101
twhayes wrote:
Um, I had downloaded the forms to play with them earlier and noticed that it looked like it was saved as static.I have just reopened the file and it appears to me that the donotwork.pdf was saved as static. If I open it, then go to File, Form Properties, then Compatibility. It states: "Acrobat 7 (Static) PDF Form". But, in the Defaults tab, the Preview has been set to "Acrobat 7 (Dynamic) XML Form".

If you choose Save As it is defaulting to a static form. Then change the type to dynamic, and save it with another name. Now it works just fine in the Preview! (It happens to us all, at one time or another.)


Regards,
Stupid me, yes it works :) Thanks.

BTW I need to reset page 4 if I use xfa.host.resetData();
it sesets all pages.

How to reset page 4 only?
smilem
Registered: Apr 1 2008
Posts: 101
OK I found a code that I need only problem List Box and Dropdown is not reset by the code:

xfa.host.resetData("xfa.form.form1.TextField1_4,
xfa.form.form1.DropDownList1_4,DropDownList2_4,ListBox3_4");
smilem
Registered: Apr 1 2008
Posts: 101
Solved by settings fields like this:

TextField1_4.rawValue = null;
DropDownList1_4.rawValue = "Reflection";
DropDownList2_4.rawValue = null;
ListBox3_4.rawValue = "L";