Hi all,
I have two radio buttons to control deleting or updating of records.
The following javascript identifies which radio button is clicked. Then information about the record is displayed when the save button is clicked.
So, based on the client side info I’ll need to determine whether to execute the update or delete statement on the server side when the save button is clicked. How can I acheive this? how can I pass the value of the radio buttons to server side asp code.
if del_ then
str = " Delete from …
elsif upd_ then
str = " Update abc where …"
end if
This is the javascript that controls the radio button clicks
window.onload=function(){
oRadBtns = document.getElementById(‘mytbl’).getElementsByTagName(‘input’);
for(i=0; i < oRadBtns.length; i++){
oRadBtns[i].value += oRadBtns[i].parentNode.parentNode.lastChild.innerHTML;
}
document.getElementById(‘btnSave’).onclick=function(){ // my Save button
var str = "You have selected
";
for(i=0; i < oRadBtns.length; i++) {
if(oRadBtns[i].checked){
str += oRadBtns[i].value+"
";
}
}
alert(str );
My radio buttons:
<td><input type=“radio” name=“action1” value=“del_” />Delete</td>
<td><input type=“radio” name=“action1” value=“upd_” />Update</td>