Why JavaScript is not working with multiple DataPages deployed on one page?

 

Question:

Why JavaScript is not working with multiple DataPages deployed on one page?

 

Answer:

There could be many reasons why a Java Script code stops working properly. One common issue is that the DataPage elements are not being referenced properly.

JavaScript syntax such as document.forms[0] refers to your first DataPage. This could be a problem if you have multiple DataPages and want to work with fields of other DataPages.

To refer to the correct field of the right DataPage use document.getElementById("InsertRecordFIELDNAME") rather than document.forms[0].InsertRecordFIELDNAME.