|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How can I capture 3 values to a database from a single radio button in ASP ?
My code lets a user select books for purchasing. When the user selects a book, the no. of books selected and the total price is calculated. I want a code that can also capture the title of the book to the database.
My current code is as follows: function calculate(){ var frm = document.forms[0]; var items = 0; var idxA = getSelectedRadio(frm.a); var idxB = getSelectedRadio(frm.b); var idxC = getSelectedRadio(frm.c); var idxD = getSelectedRadio(frm.d); var idxE = getSelectedRadio(frm.e); var a = idxA > -1 ? frm.a[idxA].value*1 : 0; var b = idxB > -1 ? frm.b[idxB].value*1 : 0; var c = idxC > -1 ? frm.c[idxC].value*1 : 0; var d = idxD > -1 ? frm.d[idxD].value*1 : 0; var e = idxE > -1 ? frm.e[idxE].value*1 : 0; if(a)items++; if(b)items++; if(c)items++; if(d)items++; if(e)items++; frm.T1.value=items; frm.answer.value = a+b+c+d+e; } function getSelectedRadio(grp){ for(i=0;i<grp.length;i++){ if(grp[i].checked) return i; } return -1; } |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > How can I capture 3 values to a database from a single radio button in ASP ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|