Conditional Logic
Monday, July 22, 2024 at 11:53amI am trying to understand how conditional fields and logic works in the .NET SDK C# code. I have 4 RADIO buttons, 4 TEXT fields and 4 SIGN fields. At the time of signing I need to be able to choose a RADIO button and this will trigger enabling a text box related to this button plus enabling the SIGNHERE related to it. At the same time will disable the rest of the TEXT and SIGNHERE options. Can we do that? Can you show me a code example? If I have to use the API to setup the condition and logic, can you tell me how. Attached are all my TABs from my XML file that translate to
Here is a piece of code where I define the RADIO buttons
private SignatureBuilder SetupCustomTabRadioGroup(List<SignatureDetail> signatureDetails, string groupCondition, string signerEmail)
{
// Create a new SignatureBuilder for the signer
SignatureBuilder signatureBuilder = SignatureBuilder.SignatureFor(signerEmail);
// Setup radio buttons based on the groupCondition
foreach (var detail in signatureDetails)
{
if (detail.CustomTabRadioGroupName == groupCondition)
{
// Create a radio button for each condition met
Field radioButton = FieldBuilder.RadioButton(detail.CustomTabRadioGroupName)
.WithName(detail.ConditionalParentLabel) // Ensure each radio button has a unique name but shares a group name
.WithValue(detail.ConditionalParentValue) // The value that gets submitted if this radio button is selected
.WithPositionAnchor(new TextAnchor
{
AnchorText = detail.AnchorTabString,
XOffset = detail.AT_XOffset,
YOffset = detail.AT_YOffset
})
.Build();
// Add the radio button field to the signature builder
signatureBuilder.WithField(radioButton);
}
}
return signatureBuilder;
}
Reply to: Conditional Logic
Thursday, July 25, 2024 at 12:04pmDeleted
Reply to: Conditional Logic
Wednesday, July 31, 2024 at 09:09amMy new question is why am I getting this error:
Could not create a new package one step. Exception: The remote server returned an error: (400) Bad Request. HTTP POST on URI https://sandbox.esignlive.com/api/packages. Optional details: {"messageKey":"error.validation.condition.syntaxError","message":"There is a syntax error in the conditional logic.","code":400,"name":"Validation Error"}
here is my json
{
"Id": null,
"Status": null,
"Name": "Package with variable number of signers and documents",
"Autocomplete": true,
"Signers": [
{
"Id": "1",
"PlaceholderName": null,
"GroupId": null,
"KnowledgeBasedAuthentication": null,
"Email": "[email protected]",
"FirstName": "Andy",
"LastName": "America",
"Title": null,
"Company": null,
"SignerType": null,
"Language": null,
"CanChangeSigner": false,
"Authentication": {
"Method": {},
"Challenges": [],
"PhoneNumber": null,
"IdvWorkflow": null
},
"AuthenticationMethod": {},
"ChallengeQuestion": [],
"PhoneNumber": null,
"DeliverSignedDocumentsByEmail": false,
"SigningOrder": 1,
"Message": null,
"Locked": false,
"Attachments": [],
"LocalLanguage": null
}
],
"Conditions": [
{
"Id": "12",
"Condition": "document['Agreement'].field['CUSTOM0015'].checked = true",
"Action": "document['Agreement'].field['CUSTOM0016'].disabled = false"
}
],
"Placeholders": [],
"Documents": [
{
"Name": "Form0002.PDF",
"Id": "Agreement",
"FileName": "Form0002.PDF.pdf",
"Content": "deleted",
"Index": 0,
"NumberOfPages": 0,
"Extract": false,
"Tagged": null,
"ExtractionTypes": [],
"Description": null,
"Data": {},
"Base64Content": null,
"Signatures": [
{
"GroupId": null,
"SignerEmail": "email",
"RoleId": null,
"Accepted": null,
"Page": 0,
"X": 0.0,
"Y": 0.0,
"Height": 15.0,
"Width": 480.0,
"Style": {},
"Fields": [
{
"Id": null,
"Width": 20.0,
"Height": 20.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0003",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_R_0003}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 3,
"YOffset": -10,
"Width": 20,
"Height": 20
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": true,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0004",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_TXT_0004}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -18,
"Width": 480,
"Height": 15
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": "{approval.signed}",
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": true,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": null,
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_D_0006}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -30,
"Width": 88,
"Height": 32
},
"Tooltip": null
},
{
"Id": null,
"Width": 20.0,
"Height": 20.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0007",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_R_0007}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 3,
"YOffset": -10,
"Width": 20,
"Height": 20
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": true,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0008",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_TXT_0008}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -18,
"Width": 480,
"Height": 15
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": "{approval.signed}",
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": true,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": null,
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_D_0010}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -30,
"Width": 88,
"Height": 32
},
"Tooltip": null
},
{
"Id": null,
"Width": 20.0,
"Height": 20.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0011",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_R_0011}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 3,
"YOffset": -10,
"Width": 20,
"Height": 20
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": true,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0012",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_TXT_0012}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -18,
"Width": 480,
"Height": 15
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": "{approval.signed}",
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": true,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": null,
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_D_0014}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -30,
"Width": 88,
"Height": 32
},
"Tooltip": null
},
{
"Id": null,
"Width": 20.0,
"Height": 20.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0015",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_R_0015}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 3,
"YOffset": -10,
"Width": 20,
"Height": 20
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": null,
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": false,
"Disabled": true,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": "CUSTOM0016",
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_TXT_0016}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -18,
"Width": 480,
"Height": 15
},
"Tooltip": null
},
{
"Id": null,
"Width": 200.0,
"Height": 50.0,
"Style": {},
"X": 0.0,
"Y": 0.0,
"Page": 0,
"Binding": "{approval.signed}",
"Validator": {
"Regex": null,
"MinLength": null,
"MaxLength": null,
"Message": null,
"ErrorCode": null,
"Required": true,
"Disabled": false,
"Options": [],
"Group": null,
"MinimumRequired": null,
"MaximumRequired": null,
"GroupTooltip": null
},
"Name": null,
"Extract": false,
"Value": null,
"FontSize": null,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_D_0018}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -30,
"Width": 88,
"Height": 32
},
"Tooltip": null
}
],
"Id": {
"Id": "15"
},
"Name": null,
"Extract": false,
"TextAnchor": {
"AnchorText": "{ESIG_BORR01_S_0017}",
"Occurrence": 0,
"Character": 0,
"Position": {},
"XOffset": 0,
"YOffset": -30,
"Width": 355,
"Height": 32
},
"FontSize": null,
"Optional": true,
"Disabled": false,
"EnforceCaptureSignature": false,
"FromFile": false,
"Tooltip": null
}
],
"External": null,
"ExternalSigned": null,
"Fields": [],
"QRCodes": []
}
],
"Description": "This is IdCounter new package",
"Language": null,
"ExpiryDate": null,
"UpdatedDate": null,
"CreatedDate": null,
"EmailMessage": "",
"Settings": {
"ShowLanguageDropDown": null,
"EnableFirstAffidavit": null,
"EnableSecondAffidavit": null,
"ShowOwnerInPersonDropDown": null,
"EnableInPerson": null,
"EnableOptOut": null,
"DisableOptOutOther": null,
"EnableDecline": null,
"ExpandLeftMenu": null,
"DisableDeclineOther": null,
"HideWatermark": null,
"HideCaptureText": null,
"Ada": null,
"FontSize": null,
"EnforceCaptureSignature": null,
"DefaultTimeBasedExpiry": true,
"RemainingDays": 2,
"ShowNseHelp": null,
"ShowNseOverview": null,
"ShowNseLogoInIframe": null,
"DeclineReasons": [],
"OptOutReasons": [],
"MaxAuthAttempts": null,
"ShowDownloadButton": null,
"ShowDialogOnComplete": null,
"LinkText": null,
"LinkTooltip": null,
"LinkHref": null,
"LinkAutoRedirect": null,
"LinkParameters": null,
"CeremonyLayoutSettings": null,
"MaxAttachmentFiles": null
},
"SenderInfo": null,
"Attributes": null,
"Messages": [],
"Notarized": null,
"Trashed": false,
"Visibility": null,
"TimezoneId": null
}
Reply to: Conditional Logic
Wednesday, July 31, 2024 at 09:34amDeleted