Free Support Forum - groupdocs.com

PDF Field Validations


#1

Hi



Is it possible to use the field validation set in a PDF form. E.G. Numerics only with limits, etc.



Also, I find read only fields with java script calculations in the PDF do not run and are editable and drop down combo boxes are not populated.



How can this be resolved?



Thanks

Craig




#2

Hello Craig,


Thank you for your inquiry. Yes, you can validate fields from the pdf document. Please download examples package and check “MVCParsingPdfFields” example project for how to get fields from the document and loop over them (you will find this code in the HomeController). This example shows basics of this feature, instead of adding recipient you can validate any field property in the loop.

As for the second question - sorry but could you please provide more info about it. Is these fields was in the original pdf (if yes please share this document example with us) or you have added them via Signature library (if added please share with us the code with which you have added them)

Thank you.

#3

Hi



I did base my app on that sample. Please see attached project. The “SignTest.pdf” has edit fields created in Adobe Acrobat DC. It has test length limit, numeric only fields, a calculation field and a combo box. When I run my app, none of those settings seem to come through.



Thanks

Craig


#4

Hello Craig,


Thank you for the project example. We will investigate and resolve it. Looks like it’s a bug in our library. Since that it will take some time before we come back to you with the solution. We will do our best to come back soon.

When we will have any news we will let you know here.

Sorry for the inconvenience.

#5

Hello,


We have released a new version of the Signature library . Please download it and update in your project.

For how to validate the field please check this code:

if (document != null)
{
document.ParseFields();
for (int i = 0; i < document.SignatureDocumentFields.Count(); i++)
{
document.AssignFieldToRecipient(document.SignatureDocumentFields.ElementAt(i).Guid,
document.SignatureDocumentRecipients.First().Guid);
if (document.SignatureDocumentFields.ElementAt(i).Name == “Number1”)
{
document.SignatureDocumentFields.ElementAt(i).RegularExpression = “^([0-9]{0,6})$”;
}
}
var signDocument = new SignDocument { DocumentGuid = document.Guid, RecipientGuid = document.SignatureDocumentRecipients.First().Guid };

return View(signDocument);

As you can see we have added this code line: document.SignatureDocumentFields.ElementAt(i).RegularExpression = “^([0-9]{0,6})$”;

It will add regular expression to the field with name Number1 and the field will be red if user enter more then 6 symbols or non numeric symbol. In this way you can validate all fields - just add appropriate regEx for it.

Also we have fixed the drop down field.

Best regards.

#6

Great, thanks for the reply.



From what you are saying, I would have to programmatically set the limits per form field. Is there no way the component can automatically implement the limitations and rules set in the PDF. If our situation, we have multiple different PDF documents per user that they can manage themselves and select when using the site and we would not want to have to create a code function for every user PDF.



Regards

Craig


#7

Hello Craig,


In such case you should do next: When you create a pdf form you should set validation options. For more info about it please check this documentation .


Best regards.


#8

Hi Pavel



I have set the limits and a calculation in the PDF. (using the latest Adobe Acrobat Pro DC). this PDF is in the sample code I sent you - Signtest.pdf. the fields limits, validations and calculations are set in that PDF as described in the PDF. the PDF documents we will be using in the project are complex and have numerous javascript functions for calculations and character length limits and numeric ranges. With your new update, the fields are not adhering to the configuration of the fields in the PDF.



The drop down now works 100% though.



Thanks

Craig


#9

Hello Craig,


Thank you for coming back. Unfortunately currently we doesn’t have such feature. We work on the brand new Signature library which will have a lot of new cool features. We will add this feature to our road map for further investigation and implementation. Sorry but I can’t provide any estimate date for this.

When we will have any news for you we will notify you.

Sorry for the inconvenience.

#10

Hi Pavel



Thanks for the reply’s, your service and assistance has been great.



Please let me know when there are updates regarding this functionality. Looking forward to when it is available.



Regards

Craig


#11

Hello Crag,


Thank you for such nice feedback about our support.

Sure, we will keep you updated.

Best regards.