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

Clearing a field upon entry

chohlasa
Registered: Jul 7 2008
Posts: 7
Answered

Hello,

I am trying to make it a little easier for users to understand how to format dates and times in our forms. I currently have date fields that have the default value set as "DD/MM/YYYY" etc., but when these fields are entered (either by clicking or tabbing) the default data does not disappear.

Is there a way to script these fields so that they clear upon entry? Best case scenario would clear them only on the first entry, when the default data was still there.

Thanks!

using Livecycle Designer 8.0 on XP

aerokhin
Registered: Jun 27 2008
Posts: 39
Hi!

You could try to add the following JavaScript code on enter event for your data field having default set as "DD/MM/YYYY".

if (this.rawValue=="DD/MM/YYYY") this.rawValue="";

Regards, Andrey
chohlasa
Registered: Jul 7 2008
Posts: 7
Okay, thanks -- I feel like that should help, but I have little experience doing the backend stuff in XML. Can you be a little more detailed?

this is what I put in, but it failed:

if (DateTimeField1.rawValue=="DD/MM/YYYY") DateTimeField1.rawValue="";(the field name is DateTimeField1)

Again, thanks so much -- this will be awesome when it works.
aerokhin
Registered: Jun 27 2008
Posts: 39
In XML the following has been added:

if (this.rawValue=="DD/MM/YYYY") this.rawValue="";

However I use Designer UI to add script. You could just select your datetimefield, choose enter event in script editor (press ctrl-shift-f5 if it's closed), choose javascript as language and enter the script.

Using "DateTimeField1" instead of "this" works ok.
I think the problem was that default language is Formcalc.

Hope that helps!