JackHillman

Retain PDF Field Format

0 votes
We are running into an issue where we have a SSN field that we need the signer to fill out, and want validation on it. I have set the Format to the SSN setting in my PDF and it works as designed. However once we upload and send out that as a OneSpan document we are losing that functionality. Is there a way to retain this functionality, or another way to implement it?? Thanks, Jack

Reply to: Retain PDF Field Format

0 votes
Hi Jack, During Signing Ceremony, everything on PDF will be shown in flatten which means all your forms won't be accessible when signing. As a workaround, you can put a text field in the SSN position and set a validation for the field. And for validation, you can turn off the auto-complete function of your package and after signer signed, you can have a review before completing the package. To use the field validation feature, you can refer to this guidance. And your validation can be set like this:
"validation": {
                "required": true,
                "errorMessage": "Please enter a valid SSN.",
                "pattern":  "^(\\d{3}-?\\d{2}-?\\d{4}|XXX-XX-XXXX)$"
                "maxLength": 11,
                "minLength": 9,
              }
The only thing is this validator can only restrict the length of the SSN, but can't automatically format the number. Hope this could help you! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Retain PDF Field Format

0 votes
Okay I'm getting closer to making this work. One issue I am having though. Because we are uploading our PDF before sending and not using a template, how can I get access to the .WithField definition? The signature is being picked up automatically by the way I named the field on my PDF form. Can I add a dummy .WithSignature() bit to make it work?? Thanks in advance, Jack

Reply to: Retain PDF Field Format

0 votes
Hi Jack, I believe you are using Document Extraction Feature, right? So in that case, If you use .WithSignature(), it would create a new signature approval instead of recognizing the one created by extraction ways. And you can't assign IDs for approvals in extraction methods so it seems there's no directly solution for that. What I can suggest is, you create the package first and leave it "DRAFT", then grap the approval ID and add fields for that approval. Or simply if you can, you can apply the same extraction way for the fields. And another workaround is, to use Position Extraction Feature, guidance here. The idea behind Position Extraction is, you use PDF forms just to tell OneSpan Sign the location and the size of your approval, while you still need to assign type/subtype of the fields by code. But the flexibility it brings is, you can add extra fields in .WithSignature() function. Hope this could help you! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Retain PDF Field Format

0 votes
I have added validation to a field after creating the package but before sending. (I believe this is while it's a draft). However I am not getting any validation still. I have attached a screenshot. Am I missing something? I am creating and sending with no errors - but no validation.

Reply to: Retain PDF Field Format

0 votes
Hi Jack, Although you have modified your PackageDocument object at your local, it haven't take effect to the system. You can have a try calling this function first before you send them:
eslClient.PackageService.UpdateDocumentMetadata(documentPackage, document);
The .sendPackage() function actually only sets the package status attribute to "SENT" and did nothing more than that. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Retain PDF Field Format

0 votes
I added the line you mentioned but am still getting the same result. Any ideas? Jack

Reply to: Retain PDF Field Format

0 votes
Hi Jack, Yes, for a closer look at your code, I notice that you are not grabbing the existing Field first, add a validator for it and then update it. If you were creating a new Field, it won't work properly. The attachment is the code snippet I created for you for this case. You only need to loop through Document, Signature and Field and locate the one you want and modify the code correspondingly. Please have a check on that. The attachment is Document Extraction + Add Field Validator(C# SDK) in the code share. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Retain PDF Field Format

0 votes
Okay this is what I tried initially, but the only Fields that I get are the fields that I have injected onto that document. All of my other text fields that are on my form are not there. Like mentioned before I am using document extraction. How do I get all of my fields to show up so I can add validation?

Reply to: Retain PDF Field Format

0 votes
Hi Jack, Yes, even if you are using Document Extraction, once your package has created and haven't been sent(in DRAFT status and that's what i mean by leave package in DRAFT). The fields attributes in your package JSON will be created by OneSpan Sign automatically, so when you call GetPackage(), all fields should be completed. And I just found out that, if you name your textfield in your pdf form like [Signer1.Capture1.Textfield1], your textfield will has a name of "TEXTFIELD10"(all upper case plus 10 times the ending number you use) which can be easier for you to locate your field. If you still confused about this, can you share one of your package ID to me? Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Retain PDF Field Format

0 votes
I am getting very close. Thanks for your help. The required option, and the error message are working as designed. The last issue is I cannot enter any characters into the box when signing. I tried many different Regex strings for SSN, but all of them disallow me from typing anything. Even if I comment our the Regex line, I still can not type anything. Any input? Thanks again, Jack

Reply to: Retain PDF Field Format

0 votes
Hi Jack, Please add
fieldValidator.MaxLength = 11;
fieldValidator.MinLength = 9;
in your code. Because by default, the restriction of maximum length of your field value is set to 0, that's why you can't type in anything. And I would do the corresponding corrections in our replies at this thread about this point. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off