Niveau 1
Niveau 2
Se connecter à la communauté
Connectez-vous pour voir tous les badges
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
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.
Vues
Réponses
Nombre de J’aime
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
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?
Vues
Réponses
Nombre de J’aime
Hi,
These scripts if correctly placed are not the cause of your problem, whatever it is. Double check everything.
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
Vues
Réponses
Nombre de J’aime
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
Vues
Réponses
Nombre de J’aime
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?
Vues
Réponses
Nombre de J’aime
Your script is Javascript and you have the scripteditor set for FormCalc. Change it to Javascript and your script should be fine.
Paul
Vues
Réponses
Nombre de J’aime
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?
Vues
Réponses
Nombre de J’aime
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
Vues
Likes
Réponses
Vues
Likes
Réponses