Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
I have a XML PDF form with a number of fields, including a few which auto-populate as per a script (e.g. today's time, today's date). Every time I open the (unsubmitted) form, these fields update as per the system date/time. This is expected.
I want all fields to lock when the user presses the submit button at the end of the form. Currently, even after the form is submitted, the PDF keeps updating those fields every time it is opened!
Vistas
Respuestas
Total de me gusta
Hi there,
my best bet would be having a checkbox in background with visibility's set as hidden which you would set its value checked once the form is submitted.
When your code to set values is executed in the fields, simply verify that the checkbox is unchecked before setting any value.
Additionally, you can also have a single statement in the initialize event of each objects to set their access state to readOnly when the checkbox is checked.
Hope this will help.
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Hi there,
The following link will explain how to submit a form using JavaScript.
https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/
Once you execute the code to submit a form, simply change the value of the checkbox to "checked" like the following:
//This should work if your checkbox object's value is either 1 or 0
CheckBox1.rawValue = "1";
//If you don't know for sure what's the object's value, you can use this
CheckBox1.rawValue = CheckBox1.getDisplayItem(0);
Once the check box is checked, you can have JavaScript code in the initialize event of each objects to set their access value to readOnly if the submit check box is checked
if (CheckBox1.rawValue == CheckBox1.getDisplayItem(0)){
this.access = "readOnly";
} else{
this.access = "open";
}
I hope this will help
Vistas
Respuestas
Total de me gusta
Thanks Magus. I'm struggling to follow your instructions. @radzmar posted these instructions on another forum - would these work? This is for date but I would need something similar for time -
use this script in the form:ready event of your date field:
if ($.rawValue == null) then$.rawValue = Num2Date(Date(), DateFmt(4))else$.rawValueendif
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Hi there,
I am sorry I kind of mislead you here, as I thought you were handling things a bit differently.
By the look of how you are doing things it is much simpler than I said.
Technically there would be two things you need to consider, because I found an error while trying to fill in your form.
1st: As soon as the user hits submit and there's a field in the form that isn't valid, the form will stay read only because you set it "protected" inside the preSubmit event of the submit button.
To avoid this, you can simply set the form's access back to open in the postSubmit event. If you wish to set the form back to open only when the form isn't ready to be submitted I can provide the JavaScript to do so.
2nd: To avoid fields to be calculated every time the form is open once the form is locked, all you need to do is add a condition inside the calculate event of those fields like the following:
if (form1.access eq "open") then
//calculate code
endif
The code above matches the FormCalc that's used inside the calculate event of Current date and Current time.
If there's any other field that are using JavaScript, the syntax would need to be changed, but the logic is the same.
I hope this will help, let me know if you need anything else.
Vistas
Respuestas
Total de me gusta
Hi Magus069,
Thanks for the further info. I pasted that script into the "calculate" fields for the current date and time. They are set to formcalc, and run at client. However, it's still not working; after converting to a "reader extended PDF", if I then complete and submit the form in Adobe Reader, whenever I open the submitted form in Adobe Reader, the time field still updates again.
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas