473,511 Members | 15,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Radio button problem

5 New Member
Hi frnds,
I have a problem with radio button.
I am using the below(check1 function) to display the length of the radio button.
If it has more than 1 row it alerts correctly but if it has only 1 row it says undefined what is the problem

Expand|Select|Wrap|Line Numbers
  1. function check1()
  2.     {
  3.         var len;
  4.         len = document.artist.radio1.length;
  5.         alert('rows '+len);
  6.  
  7.     //len = document.getElementById('radio1');
  8.     for (i= 0;i < len ;i++){
  9.  
  10.         if (document.artist.radio1[i].checked == true)
  11.         t = document.artist.radio1[i].value;
  12.  
  13.         }
  14.      document.artist.hid1.value = t;
  15.      alert(t);    
  16.  
  17.     }

Expand|Select|Wrap|Line Numbers
  1. while ($rowsql1 = mysql_fetch_array($rssql1))
  2. {
  3.     $countr = $countr + 1;
  4. $products_id=$rowsql1['products_id'];
  5. $products_name=$rowsql1['products_name'];
  6. $categories_id=$rowsql1['categories_id'];
  7. $refid = $rowsql1['ref_id'];
  8. $new=$rowsql1['new'];
  9. $p=$rowsql1['products_quantity'];
  10.     //echo $products_name;
  11. $sqlcategories="select categories_name from categories_description where categories_id='$categories_id'";
  12. $rscategories = mysql_query($sqlcategories) or die ("couldn't find a record");
  13. echo "row".$categories_id;
  14. $c = mysql_fetch_row($rscategories);
  15. $categories_name = $c[0]; 
  16.  
  17. if ($rowcategories == mysql_fetch_array($rscategories))
  18. {
  19.     $categories_name=$rowcategories['categories_name'];
  20. }
  21.  
  22. <td align="center"><input type="radio" id="radio1" value="<? echo $products_id; ?>" onclick="check1();"></td>
Jun 3 '08 #1
1 958
gits
5,390 Recognized Expert Moderator Expert
please post an example of the generated html-code so that we may see what the function will do during runtime.

kind regards
Jun 3 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
2526
by: JR | last post by:
Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem. I have a form with the following layout: Column A...
5
3075
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
2
1685
by: SenthilVel | last post by:
Hi i have radio buttons in my Page and i am able to see some starnge behaviour with those. 1st : DSN 2nd radio button: MSDE the above 2 are in collection.
2
3459
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
1
2949
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
9
2220
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script...
2
5877
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
4
3067
by: Z.K. | last post by:
I started a forms application and I put on the form three buttons. In the functions for the radio buttons I put in a single messagebox like: MessageBox("Hello 1") MessageBox("Hello 2") ...
7
4851
by: moksha | last post by:
Hi, I am new to javascript and i am facing a problem in coding. plz help me out. I am using javascript for dynamically creating a table row which contains text boxes and radio...
11
2256
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.