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

Field Prompt / Hint

Avatar

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
yosoybyrd
Level 1

09-09-2011

I am new to LiveCycle and will need all the help I can get...

I am creating a form mostly to be used by myself and others in my company.

I would like to find some way to add a Hint or Prompt in fields that have not been filled in. For example when filling out a contact form I would like for the field for Name to have "Name" in the text box before it is clicked on and "Address" in the address field and so on and so on.

I am sure this can be done I just have not stumbled upon it yet.

Thanks

Accepted Solutions (0)

Answers (9)

Answers (9)

Avatar

Avatar
Boost 1
Level 1
wesika
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
wesika
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
wesika
Level 1

24-06-2015

In the form:ready event you can set the caption text to remain black and normal by adding the following

this.caption.font.fill.color.value = "0,0,0"; //Change the Caption to black

this.caption.font.posture = "normal" //change the caption to normal

Avatar

Avatar
Validate 10
Level 4
kingphysh
Level 4

Likes

41 likes

Total Posts

288 posts

Correct Reply

35 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 10
Level 4
kingphysh
Level 4

Likes

41 likes

Total Posts

288 posts

Correct Reply

35 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile
kingphysh
Level 4

10-09-2011

Hi,

OK, what you do is:

==================================

Accesibility Tab / Tool Tip

put your prompt message here (i.e. Name or Address or City...whatever you want as the prompt)

==================================

SOM::initialize - (JavaScript, client)

this.execEvent("exit");
this.format.picture.value = "null{'" + this.assist.toolTip.value + "'}";

// OK, the above fires the exit event on this

// the exit event makes the prompt ghost (gray) and italic

// and then above assigns the assist.toolTip string as the prompt value

==================================

SOM::enter - (JavaScript, client)

this.fontColor = "0,0,0";
this.font.posture = "normal";

// OK, the above changes the field fontColor to "black" and posture to "normal", when you enter the field

==================================

SOM::exit - (JavaScript, client)

if (this.isNull)
{
  this.fontColor = "153,153,153";
  this.font.posture = "italic";
}

// OK, if the field contents isNull when you exit the field, the above changes the fontColor back to "gray" and posture to "italic". This event fires also upon initialization (above, remember?)

==================================

SOM::prePrint - (JavaScript, client)

this.format.picture.value = "";


// OK, changes the prompt message to "" prior to printing.

==================================

SOM::postPrint - (JavaScript, client)

this.format.picture.value = "null{'" + this.assist.toolTip.value + "'}";

// OK, changes the prompt message back to the toolTip after printing.

==================================

And, Bob's your uncle.

I think this is a slick solution--I bet you will think so too!

OK, Cheers,

Stephen

FYI: not my original idea--I read it here somewhere before.

Message was edited by: kingphysh

Avatar

Avatar
Level 1
Chad_Chelius
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
Chad_Chelius
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
Chad_Chelius
Level 1

27-08-2014

This is great. However I'm finding that when I use the javascript code to format the text, it also formats the caption. Is there any way to isolate the formatting to only the text field and not the caption?

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

13-09-2011

Your script is Javascript and you have the scripteditor set for FormCalc. Change it to Javascript and your script should be fine.

Paul

Avatar

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
yosoybyrd
Level 1

13-09-2011

When one problem goes away another takes its place.

I moved to a second form I was making, used the same code to have hints for text field, but when I went to view the the form in preview it posts this alert::

(I tried to upload a screen shot but it would not let me)

Script failed (language is formcalc; context is

xfa[0].form1[0].Page1[0].Header[0].Body[0].TextField1[0])

script=

if(this.isNull)

{this.fontColor="153,153,153";

this.font.posture= "normal";}

Error: syntax error near token '{' on line 3, column 1.

Script failed (language is formcalc; context is

xfa[0].form1[0].Page1[0].Header[0].Body[0].TextField2[0])

script=

if(this.isNull)

{this.fontColor="153,153,153";

this.font.posture= "normal";}

etc.

etc.

etc.

Any ideas on what I have done wrong this time?

Avatar

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
yosoybyrd
Level 1

13-09-2011

After I copied the code in again I have not had the same problem of Designer crashing when I attempted to save or preview it.

Thanks Stephen

Avatar

Avatar
Validate 10
Level 4
kingphysh
Level 4

Likes

41 likes

Total Posts

288 posts

Correct Reply

35 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 10
Level 4
kingphysh
Level 4

Likes

41 likes

Total Posts

288 posts

Correct Reply

35 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 25
View profile
kingphysh
Level 4

12-09-2011

Hi,

OK, when you say crashing, I'm not sure what you mean. Are you talking about

  • Designer crashing when you try to save it after you've created it?
  • Acrobat or Reader crashing when you're using the form, and then trying to save it?
  • Or, are you getting some error in Designer Preview Tab?

These scripts if correctly placed are not the cause of your problem, whatever it is. Double check everything.

  • Is language is set to JavaScript (not FormCalc) on each part?
  • Is the correct event is used on each part?--did you accidently use preSave instead of prePrint?
  • Is the Target Version for the form set correctly in the form properties? Increase the target version to Acrobat and Adobe Reader 8.0 or later for ToolTip support.

JavaScripts can fail, but these won't crash either Designer or Acrobat/Reader. If everything above checks out, then you may have to start over due to corrupt xml.

Good luck!

Stephen


Avatar

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
yosoybyrd
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
yosoybyrd
Level 1

12-09-2011

Thanks

That worked great, except for it is crashing every time I try to save it after I have all the fields set.

Do you know what would cause this?

Avatar

Avatar
Validate 1
Level 5
whyisthisme
Level 5

Likes

41 likes

Total Posts

324 posts

Correct Reply

59 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 5
whyisthisme
Level 5

Likes

41 likes

Total Posts

324 posts

Correct Reply

59 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
whyisthisme
Level 5

09-09-2011

You set the default value of the textbox under Object>Value>Default: This will put  whatever text you put in there in the textbox once the form is rendered.