Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing jsp variables to javascript after delete confirm

Status
Not open for further replies.

jannd

Programmer
May 14, 2002
3
US
I am attempting to confirm a delete request and pass a jsp variable to the confirm delete function and then to the actual function that performs the delete request.

The confirm works fine, the jsp variable is passed to the confirm delete function, but my actual delete function now fails.

Can anyone spot the error or why?

<input type=&quot;image&quot; src=&quot;./images/btn_delete.gif&quot; onClick=&quot;return confirmDelete('<%= section.getId()%>');&quot;>

// Confirm Delete Request
function confirmDelete(iSection) {
var yes=confirm('Are you sure you wish to delete ' + iSection + '?');
if (yes) {
return onDeleteSection('iSection');
}
else {
return false;
}
}

// Delete Section
function onDeleteSection(strSectionId){
document.sectionForm.Cmd.value = &quot;DeleteSection&quot;;
document.sectionForm.SectionID.value = strSectionId;
document.sectionForm.submit();
}
 
Modify the method confirmDelete()
as
// Confirm Delete Request
function confirmDelete(iSection) {
var yes=confirm('Are you sure you wish to delete ' + iSection + '?');
if (yes) {
return onDeleteSection(iSection);// This is the place where you had missed out
}
else {
return false;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top