I have a page containing form fields with menus. on clicking a button, the form fields should be validated and errors should get displayed in a row of table on a Modal window.
I have declared a global variable to capture errors of different field. Global variable is a string and the error gets added as rows as shown below
first I initialize a global variable var gErrorTableRow = "";
The same variable keeps get append with table row based on errors of particular field name like shown below.
gErrorTableRow += '<tr><td>'+sFieldName+'</td><td>Enter Non Zero Value</td></tr>';
the table row shall get displayed on a Modal window on clicking a button.
But the variable gErrorTableRow is getting append with errors again and again even after i re initialize the if variable 'gErrorTableRow = "" ;' after modal window show., on clicking the button.
How to re initialize this gErrorTableRow variable without refreshing the page.
I re edited based on the comments, hope i am clear now.