-
1. Re: Field Prompt / Hint
whyisthisme Sep 9, 2011 3:41 PM (in response to yosoybyrd)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.
-
2. Re: Field Prompt / Hint
kingphysh Sep 10, 2011 9:52 PM (in response to yosoybyrd)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
-
3. Re: Field Prompt / Hint
yosoybyrd Sep 12, 2011 7:36 AM (in response to kingphysh)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?
-
4. Re: Field Prompt / Hint
kingphysh Sep 12, 2011 8:44 PM (in response to yosoybyrd)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
-
5. Re: Field Prompt / Hint
yosoybyrd Sep 13, 2011 5:52 AM (in response to kingphysh)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
-
6. Re: Field Prompt / Hint
yosoybyrd Sep 13, 2011 1:25 PM (in response to yosoybyrd)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?
-
7. Re: Field Prompt / Hint
pguerett Sep 13, 2011 1:30 PM (in response to yosoybyrd)Your script is Javascript and you have the scripteditor set for FormCalc. Change it to Javascript and your script should be fine.
Paul
-
8. Re: Field Prompt / Hint
Chad Chelius Aug 27, 2014 11:35 AM (in response to kingphysh)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?





