Hi Guys,
Troester: Yes the two rows link to the same record. If I go click into or hover my mouse over each link you can see they point to the same row id. ... Just wasn't sure how to show that in a screenshot.
Hugh: not sure what you mean by AJAX context, but it basically I have 5 dropdowns which ask the users whether they've completed their section. When the user changes the dropdown to 'yes' then the form submits. Only happens with the first dropdown submit. Subsequest changes to the other dropdowns don't create any further duplicate rows. Code below:
function agreement(x)
{
var elementID = x.element.get('id');
var val = document.getElementById(elementID).options[document.getElementById(elementID).selectedIndex].value;
/*Check if dropdown has been set to yes*/
if(val=='Yes')
/*Ask for confirmation*/
{var response=confirm("You are about to digitally confirm that you have filled in all relevant sections. This cannot be undone. Are you sure?");
if (response==true)
{
var currentdetails = document.getElementById("idps___audit_details").value;
var user = document.getElementById("idps___user_name").value;
var dropdownID = x.element.get('id');
var filledoraccept = dropdownID.substring(7,8);
var section =dropdownID.slice(-1);
var ts = new Date();
var yy1= ts.getFullYear();
var mm1= ts.getMonth()+1;
var dd1= ts.getDate();
var hh= ts.getHours();
var mm= ts.getMinutes();
if(mm1<10){var mm1="0"+mm1;}
if(dd1<10){var dd1="0"+dd1;}
if(mm<10){var mm="0"+mm;}
if(hh<10){var hh="0"+hh;}
var tsdisp=yy1+"-"+mm1+"-"+dd1+" at "+hh+":"+mm;
if(filledoraccept == "f")
{if(section == "F")
{var txt = "Final Rating filled by ";}
else
{var txt = "Initial Form filled by ";}}
else
{var txt = "Final Ratings Accepted by ";}
document.getElementById("idps___audit_details").value = currentdetails+"\n|| "+txt+user+" on "+tsdisp;
document.forms["form_23"].submit();
}
else
{document.getElementById(elementID).selectedIndex = 0;}/*Change dropdown to NO*/
}
else
{document.getElementById(elementID).selectedIndex = 0;}
I'll give your code above a test and see what happens.