Disable tables from adding a "NaN" in rows that are not used

I have a custom doc type with a table in which I can add a new row and fill it with data. When I click to initiate the insertion of a row the popup comes up, but if I click outside of the popup, a row gets added with “NaN”. This only happens when I click outside of the popup. If I press escape, the table does not get touched or the word “NaN” does get added.

How can this be addressed?

@jpp,

NaN may be gets added to the while trying to parse the invalid number. Is there any custom script added for the doctype?

Can you share your code?

Thanks,
Makarand