Math in a template
Friday, December 17, 2021 at 09:08amHi,
At OneSpan Sign Template Fields | OneSpan Community Platform there is a list of fields in the New Account SignupTemplate, one of which is {name:"driversAge", with a value of
value:Math.abs((new Date(Date.now() - (new Date($("#inputDateOfBirth").val()).getTime()))).getUTCFullYear() - 1970)},
How can I replicate this field on my own templates using the .NET SDK?
Reply to: Math in a template
Friday, December 17, 2021 at 01:17pmHi David,
Please kindly be aware that this guide is only applicable for the MyBank Demo site, where it uses a web form to collect the DOB before creating the transaction. If you are looking for a calculated field with formula, it's temporary not available, and we can definitely raise it as an Enhancement Request for future product enhancement.
Duo
Duo Liang OneSpan Evangelism and Partner Integrations Developer
Reply to: Math in a template
Tuesday, February 22, 2022 at 08:12amDuo, this would really be a valuable enhancement and I would love to see this added to the product. For the short term, do you know of any other workarounds?
Reply to: Math in a template
Tuesday, February 22, 2022 at 08:40amHi David,
As a workaround, you can use date picker field to allow user to enter DOB, and a text field with numeric validation for the age, please see below .NET SDK code:
OssClient ossClient = new OssClient(apiKey, apiUrl);
DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Test Package .NET")
.WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
.WithFirstName("Signer First Name")
.WithLastName("Signer Last Name")
.WithCustomId("Signer"))
.WithDocument(DocumentBuilder.NewDocumentNamed("sampleAgreement")
.FromFile("your_file_path")
.WithSignature(SignatureBuilder.SignatureFor("[email protected]")
.OnPage(0).AtPosition(175, 165).WithSize(150,50)
.WithField(FieldBuilder.Datepicker().WithId("DOB")
.OnPage(0).AtPosition(175, 265).WithSize(150, 50)
.WithValidation(FieldValidatorBuilder.DatepickerFormat("YYYY-MM-dd").Required().WithErrorMessage("Please select your date of birth!")))
.WithField(FieldBuilder.TextField().WithId("Age")
.OnPage(0).AtPosition(175, 365).WithSize(150, 50)
.WithValidation(FieldValidatorBuilder.Numeric().Required().WithErrorMessage("Please enter your age!")))
))
.Build();
PackageId packageId = ossClient.CreatePackageOneStep(superDuperPackage);
ossClient.SendPackage(packageId);
Duo
Duo Liang OneSpan Evangelism and Partner Integrations Developer
Reply to: Math in a template
Wednesday, February 23, 2022 at 08:44amThanks but I was thinking more along the lines of replicating what was done for the MyBank Demo site? What would I need to do to create a similar setup?