Form Field Date and how to set the formatting

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Form Field Date and how to set the formatting

Post by prime clinical systems »

Hi, I've looked everywhere I can think of and need to know how to specifiy a form field as type date, to use the drop down, and set the format for the date.
I found the sample code to detect if a field already has date formatting, like this, since the flag for date TFF_Date is still not working this method was required:

Dim FField As IPXC_FormField
Dim Annot As PDFXEditCtl.IPXC_Annotation
FField.Flags = TFF_Date
Set Annot = FField.Widget(0)
Me.PDF.Doc.CoreDoc.CosDocument.LockDocument
Dim AA As PDFXEditCtl.IPXS_PDFVariant
Dim F As PDFXEditCtl.IPXS_PDFVariant
Set AA = Annot.PDFObject.Dict_Get("AA")
Set F = AA.Dict_Get("F")
Dim sS As String
Dim nAtom As Long
nAtom = Me.p_pxsInst.StrToAtom("S")
sS = F.Dict_GetStringA(nAtom, "")
If sS = "JavaScript" Then
Dim sJS As String
sJS = F.Dict_GetString("JS", "")
If InStr(sJS, "AFDate_Format") Then
'type is date, this works fine for existing field
End If
End If
Me.PDF.Doc.CoreDoc.CosDocument.UnlockDocument
Set Annot = Nothing

But when trying to set this "F" object with the format, well it does not exist after creating a form field ("Text1") from scratch, just the AA object exists, so a code sample to set the formatting
"AFDate_Format("mm/dd/yyyy")" to this is what I need, as I can only get this far:
Dim FField As IPXC_FormField
Dim Annot As PDFXEditCtl.IPXC_Annotation
Set FField = Me.PDF.Doc.CoreDoc.AcroForm.GetFieldByName("Text1")
FField.Flags = TFF_Date
Set Annot = FField.Widget(0)
Me.PDF.Doc.CoreDoc.CosDocument.LockDocument
Dim AA As PDFXEditCtl.IPXS_PDFVariant
Dim F As PDFXEditCtl.IPXS_PDFVariant
Set AA = Annot.PDFObject.Dict_Get("AA")
Set F = AA.Dict_Get("F") 'this line throws error that object AA.Dict_Get("F") does not exist

Similarly, if I want to have a Numeric Field, or format a text box for SS# etc, how would I do that as well?

ce
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Form Field Date and how to set the formatting

Post by Sasha - Tracker Dev Team »

Hello Clifford,

Replied you here:
https://forum.pdf-xchange.com/ ... 22#p114173

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply