Edition: Hotdocs Classic
I'm trying to pre-fill answers for a user based on a MC selection. But I just want it as a 'pre-fill' not a set.
When I use the script below, it basically 'greys out' the fields. The user can't edit it.
I want the fields to be pre-filled like a normal "DEFAULT" function and the user can still edit it.
But in the below, the DEFAULT works like "SET" and it locks the entry in and the user is no longer able to edit.
I feel like I'm missing a trick here.
This is what I have in the Repeating Dialog script:
//Populate the multichoice variable with names of the owners from previous screen.
CLEAR partyPopulatePartyWithOwner
IF ANSWERED(own1FirstName)
ADD "owner1|«own1FullName»" TO partyPopulatePartyWithOwner
END IF
IF ANSWERED(own2FirstName)
ADD "owner2|«own2FullName»" TO partyPopulatePartyWithOwner
END IF
//Auto-populate name field if user selected to auto-populate
IF partyPopulatePartyWithOwner = "owner1"
//Erase incase the owner has changed their mind (selected owner2, and now selects owner1)
ERASE partyFirstName
ERASE partyMiddleName
ERASE partyLastName
DEFAULT partyFirstName TO own1FirstName
DEFAULT partyMiddleName TO own1MiddleName
DEFAULT partyLastName TO own1LastName
ELSE IF partyPopulatePartyWithOwner = "owner2"
//Erase incase the owner has changed their mind (selected owner1, and now selects owner2)
ERASE partyFirstName
ERASE partyMiddleName
ERASE partyLastName
DEFAULT partyFirstName TO own2FirstName
DEFAULT partyMiddleName TO own2MiddleName
DEFAULT partyLastName TO own2LastName
END IF
Get rid of the "erase" instructions. This will sound weird but hear me out. You can resolve this issue by creating a hidden number variable and setting it to 1 or 2, and then checking to see if that number variable evaluates to 1 or 2, and then returning the number variable to its original state. Let me give you a simplified example:
HIDE numVar
SET numVar to 0
IF ANSWERED mcVar1
IF numVar = 0
SET numVar TO 1
END IF
IF numVar = 1
SET tePartyName TO teOwnerName
SET numVar TO 2
END IF
IF numVar = 2
IF tePartyName != teOwnerName
SET numVar TO 0
END IF
END IF
END IF
Does this make sense? I can explained further. Sorry for poor formatting. I'm doing this from my phone right now lol.
This method allows you to essentially replace variables, without being stuck with a SET answer as the number changes.