LCG | Posts: 5

DatePicker "SigningDate" fails on selecting date

0 votes

Hi friends,

I have an issue with signing data from the web interface. DatePicker fails on open and I can`t select date.
Javascript error "TypeError: Cannot read properties of null (reading 'length')";

I using VS2019, C#, WebView2 component

string tempDir2 = Path.GetTempPath();
CoreWebView2EnvironmentOptions options = null;
CoreWebView2Environment webView2Environment = await          CoreWebView2Environment.CreateAsync(null, tempDir2, options);
await webBrowser1.EnsureCoreWebView2Async(webView2Environment);
webBrowser1.Source = new Uri(url);


LCG | Posts: 5

Reply to: DatePicker "SigningDate" fails on selecting date

0 votes

WinForms application. OneSpan web page several pages has DatePicker at the second page


Duo_Liang | Posts: 3776

Reply to:

0 votes

Hi LCG,

 

Thanks for your post! According to your description, it sounds like when your code defines the datepicker field, it didn't specify the date format (it's one of the field validation). If you are developing with .NET SDK, check below sample code:

 

            FieldBuilder datepicker = FieldBuilder.Datepicker()
                    .WithValidation(FieldValidatorBuilder.Regex("YYYY-MM-dd").Required().WithErrorMessage("Please select a current or past date!"))
                    .OnPage(0)
                    .AtPosition(300, 300)
                    .WithSize(200, 55);

            DocumentPackage package = PackageBuilder
                    .NewPackageNamed("Sample Package")
                    .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]").WithFirstName("John").WithLastName("Smith"))
                    .WithDocument(DocumentBuilder.NewDocumentNamed("Document1").FromFile("your_file_path").WithId("DOCUMENT1")
                            .WithSignature(SignatureBuilder.SignatureFor("[email protected]")
                                    .OnPage(0)
                                    .AtPosition(100, 100)
                                    .WithSize(200, 55)
                                    .WithField(datepicker)
                                    ))
                    .WithStatus(DocumentPackageStatus.SENT)
                    .Build();
            PackageId packageId = ossClient.CreatePackageOneStep(package);
            Debug.WriteLine(packageId);

 

Duo


LCG | Posts: 5

Reply to:

0 votes

Hi, Thank you for your reply.

We are not defining datepicker from the code. We are loading web page into web browser component Microsoft.WebView2.

https://apps.esignlive.com//auth?signerAuthenticationToken=[tokenExpired]&target=[someTarget]

Web page has an issue with loading js script or js package


Duo_Liang | Posts: 3776

Reply to:

0 votes

Hi LCG,

 

I understood that you were experiencing the JS error when loading the Signing Ceremony in a web page, however, the issue was caused when the package first got created. Therefore, it could worth a check for that part of code.

 

Duo


LCG | Posts: 5

Reply to: DatePicker "SigningDate" fails on selecting date

0 votes

Try, let me check


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