Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Ghost text in a numeric field.

Avatar

Avatar
Level 1
Donzo_8855
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
Donzo_8855
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
Donzo_8855
Level 1

12-12-2012

Hello,

I'm trying to format a numeric field, but one that has a ghost instructional text in it. I've found this wonderful link that provides script to accomplish the ghost text (which I've used successfull throughout the form) ...at this link: http://cookbooks.adobe.com/post_Adding_Ghost_Text_to_LiveCycle_Designer_form-18436.html

..But this scripting seems to override the $ZZZ,ZZZ,ZZ9.99 format that I'd like to use. Or if I pull out the scripting, format will work, but ghost text will not show. It seems that the scripting from that link above is conflicting/overwriting the "picture" variable of the <format>...</format> command. And I don't know enough about Javascript to know how to work around/with it.

(In short, I'm trying to elicit a user-entered list of dollar amounts for "debts owned" in that form area with ghost text that initially reads "Amount"; but one that will follow a consistent formatted output.)

..And if I successfully get the ability to do this one, the next column will attempt to do the same thing for "Interest Rate" formatted entries -- although I suspect that those two codes might be similar.


Thanks!

Accepted Solutions (0)

Answers (4)

Answers (4)

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

14-12-2012

Hi,

I can see my script would cause a problem with your format picture, and still am not sure of the best way to solve it but here is one way. 

In the patterns dialog for your numeric field add a pattern like null{'Amount'}|num{$ZZZ,ZZZ,ZZ9.99}. (You can just cut and paste this sample or add your format pattern and select Allow Empty and type in the text you need (like "Amount"),

Then make the following changes to the script.

form1.#subform[0].#subform[1].NumericField1::prePrint - (JavaScript, client)

this.format.picture.value = this.format.picture.value.replace(/null\{.*?\}/, "");

form1.#subform[0].#subform[1].NumericField1::postPrint - (JavaScript, client)

this.format.nodes.remove(this.format.getElement('picture'));

form1.#subform[0].#subform[1].NumericField1::ready:form - (JavaScript, client)

this.execEvent("exit");

So now because you have added the format pattern in the Designer UI you can remove the second line of the ready:form script.  The prePrint and postPrint are all about removing the ghost text if the user decides to print the form, so you may not need that code at all.  In the code above the prePrint code will remove the null{} clause from the pattern and the postPrint code will remove the pattern element from the Form DOM, which means it will revert back to the value that is in the Template DOM, which means this code is doesn't need to know the pattern you used in the Designer UI.

Hope that helps

Bruce

Avatar

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

110 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

110 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
Jono_Moore
Level 8

13-12-2012

Oh I see. Not sure if this helps but you can use format.picture.value to set the patterns:

FieldName.format.picture.value = "num.currency{}";

FieldName.format.picture.value = "num{(zz9.zz'%')}";

So you might be able to force it back to what you want.

I've used that ghosting script once before but can't remember much about it. BR001 here on the forums wrote it so maybe he'll see the post.

Avatar

Avatar
Level 1
Donzo_8855
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
Donzo_8855
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
Donzo_8855
Level 1

13-12-2012

Thanks Jono, Actually the "ghosting" does work, probably because it's hard-coding behind the scenes, before it hits the verification-for-numeric. But I don't know enough about coding and/or the pattern portion of the "picture" field to keep them from stepping on each other.

Avatar

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

110 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

110 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
Jono_Moore
Level 8

12-12-2012

I don't think it's going to work as you can't put text in a numeric field.