Advertisement

01.14.2008 at 11:17PM PST, ID: 23083172
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

My Radio Button dont work properly

Asked by upm903 in Active Server Pages (ASP), Extensible HTML (XHTML)

Tags:

My Radio Button Dont work in the Do while properly.
I try to read Doctors code and name and display them on input form for user to choose from them thru Radio Button. But Doesnt work.
It works if I dont generate them in the Do While.
Probably i did something wrong in coding.
Pls help cant figure it out.
HishamStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
<html>
<head>
<% session.lcid=2057  %>
 
 
<%
 
 
 
Dim adoCon 			'Holds the Database Connection Object
Dim rsGuestbook			'Holds the recordset for the record to be updated
Dim strSQL			'Holds the SQL query for the database
Dim lngRecordNo			'Holds the record number to be updated
Dim GrandTotal
GrandTotal =0
Set adoCon = Server.CreateObject("ADODB.Connection")
 
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")
 
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
 
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
Set Rs2 = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM Doctors order by Doctorcode " 
 
'Open the recordset with the SQL query 
rsGuestbook.Open strSQL, adoCon
 
 
 
 
 
 
 
%>
 
 
 
 
 
 
 
 
 
<title> Adding to database example </title>
<body bgcolor="#eed5d2">
<h1 align="center" style="font-family:verdana; color:#00ffff" >Add Daily Transaction </h1>
<script type="text/javascript">
<!--
function validate()
{
 
  
	
	
		
	
		
		if(document.form.Custno.value=="")
  {
   alert("Cust Code is missing");
   return false;
  }
 
	if(document.form.ReceiptNo.value=="")
  {
   alert("Receipt No is missing");
   return false;
  }
	
	
	
if(document.form.DateIN.value=="")
  {
   alert("TRX Date  is missing");
   return false;
  }
 	
	if(document.form.Service1.value=="")
  {
   alert("Service1 Code missing");
   return false;
  }
 
	  	
	
		
		
 
if(document.form.Amount1.value=="")
  {
   alert("Amount1  is missing");
   return false;
  }
	
 
 if(document.form.Service2.value=="")
  {
    var btn = valButton(form.Emp2);
    if (btn == null) ;
    else 
        {
        alert("Service2 Code Missing");
        return false;
        }
  }
   else
	     {
         var btn = valButton(form.Emp2);
         if (btn == null) 
				 {
				  alert("Missing222 Employee Code 2");
          return false;
          } 
			 }
	
	
	
	
	if(document.form.Amount2.value=="")
  {
    var btn = valButton(form.Emp2);
    if (btn == null) ;
    else 
       {
          alert("Amount2 Must be Entered");
          return false;
       }
   }
	 else
	     {
         var btn = valButton(form.Emp2);
         if (btn == null) 
				 {
				  alert("Missing Employee Code 2");
          return false;
          } 
			 }
	
	if(document.form.Service3.value=="")
  {
    var btn = valButton(form.Emp3);
if (btn == null) ;
else 
{
alert("Service3 Code Missing");
   return false;
 }
  }
	
	
	
	
if(document.form.Amount3.value=="")
  {
    var btn = valButton(form.Emp3);
    if (btn == null) ;
    else 
       {
          alert("Amount3 Must be Entered");
          return false;
       }
   }
	 else
	     {
         var btn = valButton(form.Emp3);
         if (btn == null) 
				 {
				  alert("Missing Employee Code 3");
          return false;
          } 
			 }
	
	
	
	
	
	
 
	
	
	
	
	
	
	
	
	
	// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
function valButton(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
   if (btn[i].checked) {cnt = i; i = -1;}
   }
if (cnt > -1) return btn[cnt].value;
else return null;
}
	
}
 
//-->
 
</script>
<script type="text/javascript">
function domath(val1,val2)
{
//To convert the passed values into numbers again
 
val1=val1-0;
val2=val2-0;
/*switch (op)
{
case "+":
return (val1 + val2);
case "-":
return (val1 - val2);
case "*":
return (val1 * val2);
case "/":
return (val1 / val2);
}//end case
*/
 
return(val1 - (val1 * (val2 / 100)) );
 
}//end function
 
 
function domath1(val1,val2,val3)
{
//To convert the passed values into numbers again
 
val1=val1-0;
val2=val2-0;
val3=val3-0;
return (val1+val2+val3);
}
 
function add1() 
{
}
</script>
</head>
<body>
<form name="form" method="post" action="trxsaveall.asp" ><b><font color=red>
Customer </font></b><input type="text" name="Custno" Size="6" maxlength="6" > <b><font color=red>
ReceiptNo :  </font></b><input type="text" name="ReceiptNo" size="10" maxlength="10" ><br><b><font color=red> 
Date In <input type="text" Size="10" maxlength="10" name="DateIN"  Value="<%Response.write(Date())%>"> <br>
Comment 1 : <input type="text" name="Comment1" Size="100" maxlength="100" ><br><br>
 
 
 
 
 
 
<%
 
set conn=server.CreateObject ("adodb.connection")
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
      Server.MapPath("db1.mdb") & ";Persist Security Info=False"
conn.Open connect
 
 
 
 
 
 
   Set oRs2=Server.CreateObject("adodb.recordset")
strSQL2="SELECT * FROM Doctors"
strSQL2=strSQL2 & " ORDER BY DoctorCode"
oRs2.Open strSQL2,conn
dim iloop
iloop=0
 	Response.Write  "<b><font color=Blue>- Employee  1  No</font></b><INPUT checked name='"&Emp1&"' type=radio VALUE='"&oRs2("DoctorCode") & "'> " & oRS2("DoctorCode") & " " & oRS2("DoctorName")
	     
  oRs2.MoveNext
Do While not oRs2.EOF
   
            	Response.Write  "<INPUT type=radio  name='"&Emp1&"' VALUE='"&oRs2("DoctorCode") & "'>" & oRS2("DoctorCode") & " " & oRS2("DoctorName")
	            oRs2.MoveNext
	
			 
		
Loop
 
%>
 
 			 
	<br>
 
		Service1 : <input type="text" name="Service1" Size="2" maxlength="2" >			
 
	Amount1 : <input type="text" name="Amount1" size="6" maxlength="6"  >
	Discount1 : <input type="text" name="Discount1" size="4" maxlength="4" >
 
 
	Total1 : <input type="text" name="Total1" size="5" maxlength="6" ><br> <br>
 
 
<b><font color=Blue>- Employee  2  No</font></b>  <INPUT TYPE=RADIO NAME="Emp2" VALUE=1 unchecked> 01 Paolo
      
    			 <INPUT TYPE=RADIO NAME="Emp2" VALUE=15>15 Emily
	    <INPUT TYPE=RADIO NAME="Emp2" VALUE=35>35 John
					 <INPUT TYPE=RADIO NAME="Emp2" VALUE=55>55 Bill	
					  <INPUT TYPE=RADIO NAME="Emp2" VALUE=56>56 Ann										
     <INPUT TYPE=RADIO NAME="Emp2" VALUE=60>60 Other<br>	
	
  <br>	
				 
	
 
 
 
 
	Service2 : <input type="text" name="Service2" Size="2" maxlength="2" >			
Amount2 : <input type="text" name="Amount2" size="6" maxlength="6"  >
Discount2 : <input type="text" name="Discount2" size="4" maxlength="4" >
  Total2 : <input type="text" name="Total2" size="6" maxlength="6" ><br> <br>
 
	
 
<b><font color=Blue>- Employee  3  No</font></b>  <INPUT TYPE=RADIO NAME="Emp3" VALUE=1 unchecked> 01 Paolo
       <INPUT TYPE=RADIO NAME="Emp3" VALUE=15>15 Emily
	  <INPUT TYPE=RADIO NAME="Emp3" VALUE=35>35 John
						 <INPUT TYPE=RADIO NAME="Emp3" VALUE=55>55 Bill	
				  <INPUT TYPE=RADIO NAME="Emp3" VALUE=56>56 Ann										
   <INPUT TYPE=RADIO NAME="Emp3" VALUE=60>60 Other<br>	
	
 
  <br>	
				 
	
	
 
Service3 : <input type="text" name="Service3" Size="2" maxlength="2" >
Amount3 : <input type="text" name="Amount3" size="6" maxlength="6"  >
Discount3 : <input type="text" name="Discount3" size="4" maxlength="4" >
Total3 : <input type="text" name="Total3" size="10" maxlength="6" ><br> 
 
 
<br>
<input type ="button" name="add" value= "Calc" onClick="Total1.value=domath(Amount1.value,Discount1.value);Total2.value=domath(Amount2.value,Discount2.value);Total3.value=domath(Amount3.value,Discount3.value);reciept.value=domath1(Total1.value,Total2.value,Total3.value) ;" >
<input type="text" name="reciept"/><br/>
<input type="submit" name="Save" value="Submit" onClick="return validate();">
</form> 
 
<table>
<tr>
<td valign=top><font color=red>*</font>&nbsp;</td>
<td valign=top><b>Service/Description</b></td>
<td valign=top>&nbsp;&nbsp;&nbsp;</td>
<td valign=top>
<select name=Service>
	<option value="" color=red >-- Select a Service/Price --
</select>&nbsp;&nbsp;
</td>
<td valign=top>&nbsp;</td>
</tr>
</table>
<p align="center">
<a href="Trx.asp" class="lnk" style="font-family:verdana; color:#0099cc"  ><b>TRX Menu<b></a> 
 
</body>
</html>
[+][-]01.14.2008 at 11:23PM PST, ID: 20660718

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Active Server Pages (ASP), Extensible HTML (XHTML)
Tags: ASP HTML
Sign Up Now!
Solution Provided By: asvforce
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.14.2008 at 11:27PM PST, ID: 20660730

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2008 at 11:32PM PST, ID: 20660741

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628