Code to make a textfield mandatory

0 votes
Hi Duo, As discussed, could you please provide the codeshare / snippet to mark a text field manadtory? Below is the client's requirement: if we add into the document a text field which the signer has to fill out, can we make that mandatory and can we request that this field is filled out only be specific signers? Let me know if you need any other information. Thanks!

Reply to: Code to make a textfield mandatory

0 votes
Hi Sahana, The feature your requirement mentioned was Field Validator, kindly check our Field Validators guide. And here's a working code snippet in Java SDK:
		EslClient client = new EslClient(API_KEY, API_URL);
		String signerEmail = "[email protected]";
		DocumentPackage pkg1 = PackageBuilder.newPackageNamed("Sample Contract")
								.atPosition(100, 100)
										.atPosition(100, 200)
												.withErrorMessage("This field is mandatory!"))
		PackageId packageId = client.createAndSendPackage(pkg1);

With above code, you can assign a signature to a signer, and bind the text field to this signature, so that the text field is only visible to this specific signer during signing ceremony. Also, we used a field validator with required attribute to make the textfield mandatory. Hope this could help! 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