Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

nothing entry keep invisible

Avatar

Level 5

Date field set following:

   object > value > Date

Also set:

   Object > field > pattern > 04/01/2007

In this case, I wish if user do not select date, date field will be invisible during print. What is the code with a view to this?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Okay,

Here is your form back to you: https://acrobat.com/#d=FjEBKIMl4SQV*bS9lZBrFQ

  • The script stays the same.
  • I would delete the default value, which is a text string. (Object > Value palette).
  • Then in the Object > Field palette, click Patterns. In the Display Patterns, tick Allow empty and type in "Date".

null pattern.png

This will work better, because as soon as the user clicks the date field, the "Date" will disappear immediatly, they do not need to delete it.

Good luck,

Niall

View solution in original post

11 Replies

Avatar

Level 10

Hi,

You would need a small script in the prePrint event and the postPrint event of the date object.

prePrint (JavaScript)

if (this.rawValue === null)

{

     this.presence = "invisible";

}

postPrint (JavaScript)

this.presence = "visible";

Hopefully that will work for you,

Niall

Avatar

Level 5

Thanks for reply.

I placed those but during print date filed remained visible, not invisible.

Avatar

Level 10

Hi,

Make sure that the form is saved as a Dynamic XML Form in the save-as dialog:

LC SaveAs Dialog.png

As I understand your query: if the date field is blank, then you don't want it to print? The date field is only to print if the user has selected a date. Is that correct?

Niall

Avatar

Level 5

Yes, I want so.

This file is dynamic XML form (.pdf)

Avatar

Level 5

One thing is that I have set following:

object > value > default > date

I seem this does not work for default value.

I want also keep the default value as date.

I hope you have realized.

Avatar

Level 10

Hi,

Check that there isn't any script in one of the date field's events that is setting the date when the form is opened.

Like this in the layout:ready event:

// Current Date in short-style date format

$.rawValue = num2date(date(), DateFmt(1))

Can you share your form? if so, upload it to a file sharing site and then post the published link here.

Niall

Avatar

Level 5

here the file:

http://www.mediafire.com/?lfobc26rxs2w6vf

having seen it I hope will realize what I want.

Avatar

Correct answer by
Level 10

Okay,

Here is your form back to you: https://acrobat.com/#d=FjEBKIMl4SQV*bS9lZBrFQ

  • The script stays the same.
  • I would delete the default value, which is a text string. (Object > Value palette).
  • Then in the Object > Field palette, click Patterns. In the Display Patterns, tick Allow empty and type in "Date".

null pattern.png

This will work better, because as soon as the user clicks the date field, the "Date" will disappear immediatly, they do not need to delete it.

Good luck,

Niall

Avatar

Level 5

Nice work.

If I want the date format like 01/01/2001. So, how can I set it.

present format is jan 22, 2011.

Avatar

Level 5

I have found the solution.

Thanks a lot.I am grateful to you.