Expand my Community achievements bar.

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

Saving enhanced reader rights saves date

Avatar

Level 7

I have a script to insert the current day's date in a form. When I save the form with enhanced reader rights, it of course saves that day's date. Is there a way to add the enhanced readers rights and still have the script work to fill  in the current day's date for the end user?

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

you can solve this problem.

1. Wrap your date script in an if/else expression - this is a FormCalc example:

if ($.rawValue == null)then

     $.rawValue = Num2Date(date(), "DD.MM.YYYY")

else

     $.rawValue

endif

2. Before you Reader enable the form, clear the field. It will stay blank because of the if/else expression.

If your field it readOnly or protected, you need to use the JS console to clear the field. - this is an sample to access the "dateField1" under Form1.Page1.Subform1.

     this.xfa.form.Form1.Page1.Subform1.dateField1.rawValue = null;

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

you can solve this problem.

1. Wrap your date script in an if/else expression - this is a FormCalc example:

if ($.rawValue == null)then

     $.rawValue = Num2Date(date(), "DD.MM.YYYY")

else

     $.rawValue

endif

2. Before you Reader enable the form, clear the field. It will stay blank because of the if/else expression.

If your field it readOnly or protected, you need to use the JS console to clear the field. - this is an sample to access the "dateField1" under Form1.Page1.Subform1.

     this.xfa.form.Form1.Page1.Subform1.dateField1.rawValue = null;

Avatar

Level 7

Thanks.

Margaret Dawn

630-850-1065