Javascript to Make an Autofill Editable
I posted this somewhere else here and I didn't get the help that I needed so I'm hoping that posting it a different section might get me a bit more range. Hope that this is okay.
I am creating a form with multi-pay options available.
I would like the first payment amount ("Amount To Be Paid on First Card") to autofill with the total amount but be editable if the total amount ("Amount To Be Paid") is to be split. In that event, I would also like other fields ("Amount To Be Paid on Second Card") to become required if the first amount is lesser than the total amount.
I am entering the following code into the Amount To Be Paid on First Card custom calculation script field.
It pulls the auto fill, it makes the secondary payment field required, but it does not allow the amount to be changed from the autofill of the total amount.
I know that my script has conflicts. I'm instructing it to copy information and to make fields required in the event that the amount in the second field is lesser than the amount in the above.
I'm not knowledgable enough to figure out how to instruct it to bypass the autofill if it is changed by the user; so, even if I were to type an amount into the first card's amount to be paid feild, it readjusts and autopopulates with the data from the first field.
I am still learning (mostly from this community) and would appreciate any help that can be offered. My attempt is below. Thank you for any assistance.
event.value = this.getField("Amount To Be Paid").value;
var n = this.getField("Amount To Be Paid On First Card").value;
if (n < "Amount To Be Paid On First Card") {
testMyField(event.value, "Amount To Be Paid On Second Card");
}