I am currently working on a form to collect Family information that will be used for enrolling in a new benefit plan. My goal is to populate an array with the necessary values for each individual to create the benefit record. While researching, I have only found methods that create array values and increase the index for each value. However, what I require is adding multiple elements to each array index.
Unfortunately, the initial code I attempted did not work as expected. Although I am able to retrieve values from the form, when attempting to create the array row, it results in errors. I am seeking guidance on how to successfully achieve this task.
Upon execution of my code, I received the error message "Unable to set property 'fname' of undefined or null reference."
I understand that my approach may not be conventional, but I am struggling to find the correct methodology to proceed. Can anyone provide insight into resolving this issue?
function ValidateChgFAM()
{
formObj = self.MAIN.document.SSform2;
var Fname = formObj.FirstName11.value
var Lname = formObj.LastName11.value
var Gender = formObj.Gen11.value
var famMbrs = new Array();
famMbrs[0].fname = formObj.FirstName11.value
famMbrs[0].lname = formObj.LastName11.value
famMbrs[0].gender = formObj.Gen11.value
famMbrs[0].birthdate = formObj.Birthdate11.value
famMbrs[0].seq = "01"
Execution of this code led to another error message stating "Unable to set property 'seq' of undefined or null reference."
Although not overly familiar with Javascript, I am experienced in navigating through this system and problem solving. Any assistance in resolving this issue would be greatly appreciated.