Forum Moderators: travelin cat
Here is the relevant script:
function deleteuser(strmail,userid)
{
strmsg = 'Are you sure you want to inactivate this user (' + strmail + ')?';
if(confirm(strmsg))
{
var objform = document.getElementById('adminusers');
var objcid = document.getElementById('usercid');
var objaction = document.getElementById('useraction');
objcid.value = userid;
objaction.value = 'Delete';
objform.submit();
}
return false;
}
And now the code for a link:
<a href="javascript:void(0)" onclick="return deleteuser('a@a.com',1)"><img border="0" src="mini_delete.gif" alt="Inactivate User"></a>
Any ideas?
Thanks
David
I took your sample code and added the following bit of code (which I presume sufficiently mirrors your form HTML):
<form action="" method="get" id="adminusers">
<input type="hidden" name="usercid" id="usercid" value="" />
<input type="hidden" name="useraction" id="useraction" value="" />
</form>
I then ran this in Safari Version 2.0.4 (419.3) and it worked exactly as expected. What version are you experiencing the failure? Is there other javascript on the page that could be conflicting with this function?
First, the form is submitted with "Post" to a page for the actual deleting of the user. Second, the input field name and id attributes are different. I will change the name to equal the id and re-test, but I must use "Post" for security reasons.
Thanks
David
Thanks for your help,
David