Copy link to clipboard
Copied
Hello there
I am working on a form and I currently have the following code:
Right now, when I click the "Both" circle, it shows the name on one line. Is there any way to have it to where if they choose Debtor 1 or Debtor 2 - it displays as normal; however, when selecting both, it will stack?
1) Select Debtor 1 - Sally Jane
2) Select Debtor 2 - Bobby Jane
3) Select Both - Sally Jane
Bobby Jane
At the same time, I feel sure I will need to ensure my text box is bigger but then I'd have to have the alignment set to bottom and that way when stacked, the text will show up properly. Any help would be greatly appreciated.
Ok. Disregard. I figured it out.
var v = this.getField("Debtor").value;
if (v=="Debtor 1") {
event.value = "\n"+getField("Debtor 1").value;
}
else if (v=="Debtor 2") {
event.value = "\n"+this.getField("Debtor 2").value;
}
else if (v=="Both") {
event.value = this.getField("Debtor 1").value+"\n"+getField("Debtor 2").value;
}
Copy link to clipboard
Copied
First of all, you need to define the text field as "Multiline" (under Properties - Options).
Then just replace the space character you're adding between the two names with this: "\n"
That's the escape character for a line-break.
PS. In the future, please post your code as text (formatted as code, if possible), not as an image.
Copy link to clipboard
Copied
I apologize! So the "\n" worked. However, with it being a form - I know I have to make the box bigger to support the stacking effect. However, if the user choose just Debtor 1 or Debtor 2 - is there a way to tweak the code to still have it drop on the bottom line so that it appears to fall on the line in the form?
Now if I have the 3rd button for Both, it shows up fine.
Copy link to clipboard
Copied
Only if you change the multiline property in your code, as the vertical alignment can't be set on its own.
Copy link to clipboard
Copied
Is there a quick and easy way to get that code or to do this? You're helping me a great deal!
Copy link to clipboard
Copied
Ok. Disregard. I figured it out.
var v = this.getField("Debtor").value;
if (v=="Debtor 1") {
event.value = "\n"+getField("Debtor 1").value;
}
else if (v=="Debtor 2") {
event.value = "\n"+this.getField("Debtor 2").value;
}
else if (v=="Both") {
event.value = this.getField("Debtor 1").value+"\n"+getField("Debtor 2").value;
}
Copy link to clipboard
Copied
Nice solution! My idea was to do it like this:
var v = this.getField("Debtor").value;
if (v=="Debtor 1") {
event.target.multiline = false;
event.value = getField("Debtor 1").value;
}
else if (v=="Debtor 2") {
event.target.multiline = false;
event.value = this.getField("Debtor 2").value;
}
else if (v=="Both") {
event.target.multiline = true;
event.value = this.getField("Debtor 1").value+"\n"+getField("Debtor 2").value;
}